From 71ab68fa399f950c162dfebb26bea3edcbca6d41 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 25 Dec 2023 22:53:06 +0300 Subject: [PATCH] Fixed incorrect SCCP for SWITCH --- ir_sccp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ir_sccp.c b/ir_sccp.c index 5ddd372..6fc7704 100644 --- a/ir_sccp.c +++ b/ir_sccp.c @@ -741,7 +741,11 @@ int ir_sccp(ir_ctx *ctx) } continue; } - if (!IR_IS_BOTTOM(insn->op2)) { + if (!IR_IS_BOTTOM(insn->op2) +#if IR_COMBO_COPY_PROPAGATION + && (IR_IS_CONST_REF(insn->op2) || _values[insn->op2].op != IR_COPY) +#endif + ) { ir_ref use_case = IR_UNUSED; use_list = &ctx->use_lists[i];