From 5a6b2bceb218f5c4b243274db6620604523c9f1e Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Wed, 21 Nov 2012 17:40:35 +0100 Subject: [PATCH] Little optimization to not produce an unreachable goto instruction --- ir.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- 2.39.2