From: Wolfgang (Blub) Bumiller Date: Wed, 21 Nov 2012 16:40:35 +0000 (+0100) Subject: Little optimization to not produce an unreachable goto instruction X-Git-Tag: 0.1.9~380 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5a6b2bceb218f5c4b243274db6620604523c9f1e;p=xonotic%2Fgmqcc.git Little optimization to not produce an unreachable goto instruction --- diff --git a/ir.c b/ir.c index bf0a745..232bd69 100644 --- a/ir.c +++ b/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);