From 32ba47ab831e46a9b9b3f58717b7cad345ff7264 Mon Sep 17 00:00:00 2001 From: tobiichi3227 <86729076+tobiichi3227@users.noreply.github.com> Date: Fri, 10 Apr 2026 20:36:58 +0800 Subject: [PATCH] Fix wrong op match in peephole optimization --- src/peephole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/peephole.c b/src/peephole.c index 8d1801fd..e6f7d9cd 100644 --- a/src/peephole.c +++ b/src/peephole.c @@ -684,7 +684,7 @@ bool bitwise_optimization(ph2_ir_t *ph2_ir) /* Pattern 1: Double complement → identity * ~(~x) = x */ - if (ph2_ir->op == OP_negate && next->op == OP_negate && + if (ph2_ir->op == OP_bit_not && next->op == OP_bit_not && next->src0 == ph2_ir->dest) { /* Replace with simple assignment */ ph2_ir->op = OP_assign;