From 10c21653c1648fb7619ebe8f9787365d78574a11 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 26 Nov 2004 23:25:30 -0700 Subject: [PATCH] Simplify constant subtraction into addition. We're much better at simplifying addition, so let's try to fix it up. --- simplify.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index 3d7cd72e..85c04c1d 100644 --- a/simplify.c +++ b/simplify.c @@ -233,7 +233,14 @@ static int simplify_constant_rightside(struct instruction *insn) long long value = insn->src2->value; switch (insn->opcode) { - case OP_ADD: case OP_SUB: + case OP_SUB: + if (value) { + insn->opcode = OP_ADD; + insn->src2 = value_pseudo(-value); + return REPEAT_CSE; + } + /* Fallthrough */ + case OP_ADD: case OP_OR: case OP_XOR: case OP_SHL: case OP_SHR: if (!value) -- 2.11.4.GIT