From 51c16605dd1ae3450eb3c8a4dfad3402391fdbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ada=20Gottenstr=C3=A4ter?= Date: Mon, 16 Jan 2023 22:51:26 +0100 Subject: [PATCH] Conditionalize short sequences with same branch target --- backends/asm/optimize_ir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backends/asm/optimize_ir.c b/backends/asm/optimize_ir.c index 4bca8d281..a1ea29457 100644 --- a/backends/asm/optimize_ir.c +++ b/backends/asm/optimize_ir.c @@ -2619,6 +2619,9 @@ static int IsSafeShortForwardJump(IR *irbase) { if (ir->opc == OPC_LABEL) { if (ir->dst == target) return n; else return 0; + } else if ((curfunc->optimize_flags & OPT_EXPERIMENTAL) && ir->opc == OPC_JUMP && ir->dst == target && ir->cond == irbase->cond) { + // Found jump that goes where we want to go, anyways. + return n; } // BRK instruction cannot be conditionalized?? if (ir->opc == OPC_BREAK) {