mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
Little optimization to not produce an unreachable goto instruction
This commit is contained in:
parent
b1425dfcf1
commit
5a6b2bceb2
1 changed files with 9 additions and 0 deletions
9
ir.c
9
ir.c
|
@ -2522,6 +2522,15 @@ tailcall:
|
|||
/* fixup the jump address */
|
||||
code_statements[stidx].o2.s1 = (onfalse->code_start) - (stidx);
|
||||
stmt.opcode = vec_last(code_statements).opcode;
|
||||
if (stmt.opcode == INSTR_GOTO ||
|
||||
stmt.opcode == INSTR_IF ||
|
||||
stmt.opcode == INSTR_IFNOT ||
|
||||
stmt.opcode == INSTR_RETURN ||
|
||||
stmt.opcode == INSTR_DONE)
|
||||
{
|
||||
/* no use jumping from here */
|
||||
return true;
|
||||
}
|
||||
/* may have been generated in the previous recursive call */
|
||||
stmt.opcode = INSTR_GOTO;
|
||||
stmt.o1.s1 = (onfalse->code_start) - vec_size(code_statements);
|
||||
|
|
Loading…
Reference in a new issue