diff options
| -rw-r--r-- | simplify.c | 4 | ||||
| -rw-r--r-- | validation/optim/simplify-zero-sub.c | 1 |
2 files changed, 4 insertions, 1 deletions
@@ -1174,6 +1174,10 @@ static int simplify_constant_leftside(struct instruction *insn) if (!value) return replace_with_pseudo(insn, insn->src1); return 0; + case OP_SUB: + if (!value) // (0 - x) --> -x + return replace_with_unop(insn, OP_NEG, insn->src2); + break; } return 0; } diff --git a/validation/optim/simplify-zero-sub.c b/validation/optim/simplify-zero-sub.c index cc8fe7a3..70ce7c90 100644 --- a/validation/optim/simplify-zero-sub.c +++ b/validation/optim/simplify-zero-sub.c @@ -3,7 +3,6 @@ int zero_sub(int x) { return 0 - x; } /* * check-name: simplify-zero-sub * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: neg\\..* %arg1 |
