Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 6 ++++++ validation/optim/simplify-not-xor-cte.c | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index 8173777652af..1b6e1cc2313b 100644 --- a/simplify.c +++ b/simplify.c @@ -1478,6 +1478,12 @@ static int simplify_unop(struct instruction *insn) insn->opcode = OP_ADD; // ~(C - x) --> x + ~C insn->src2 = eval_unop(OP_NOT, insn->size, def->src1); return replace_pseudo(insn, &insn->src1, def->src2); + case OP_XOR: + if (!constant(def->src2)) + break; + insn->opcode = OP_XOR; // ~(x ^ C) --> x ^ ~C + insn->src2 = eval_unop(OP_NOT, insn->size, def->src2); + return replace_pseudo(insn, &insn->src1, def->src1); } break; case OP_NEG: diff --git a/validation/optim/simplify-not-xor-cte.c b/validation/optim/simplify-not-xor-cte.c index d3046f208fce..c3c803b30250 100644 --- a/validation/optim/simplify-not-xor-cte.c +++ b/validation/optim/simplify-not-xor-cte.c @@ -5,7 +5,6 @@ int foo(int x) { return ~(x ^ C) == (x ^ ~C); } /* * check-name: simplify-not-xor-cte * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: ret\\..*\\$1 -- 2.28.0