diff options
| -rw-r--r-- | simplify.c | 5 | ||||
| -rw-r--r-- | validation/optim/simplify-same-sub-addl.c | 1 |
2 files changed, 5 insertions, 1 deletions
@@ -1369,6 +1369,11 @@ static int simplify_add(struct instruction *insn) switch_pseudo(insn, &insn->src1, insn, &insn->src2); insn->opcode = OP_SUB; return replace_pseudo(insn, &insn->src2, def->src); + + case OP_SUB: + if (def->src2 == src2) // (x - y) + y --> x + return replace_with_pseudo(insn, def->src1); + break; } switch (DEF_OPCODE(def, src2)) { diff --git a/validation/optim/simplify-same-sub-addl.c b/validation/optim/simplify-same-sub-addl.c index 78f21739..56b6fcc2 100644 --- a/validation/optim/simplify-same-sub-addl.c +++ b/validation/optim/simplify-same-sub-addl.c @@ -3,7 +3,6 @@ int foo(int x, int y) { return (x - y) + y; } /* * check-name: simplify-same-sub-addl * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: ret\\..*%arg1 |
