diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-11-26 23:25:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:05:02 -0700 |
commit | 10c21653c1648fb7619ebe8f9787365d78574a11 (patch) | |
tree | 76eae6890503615ad1baddeb7e76aba6c4c1035e /simplify.c | |
parent | Be a lot more careful when re-writing branches. (diff) | |
download | sparse-10c21653c1648fb7619ebe8f9787365d78574a11.tar.gz sparse-10c21653c1648fb7619ebe8f9787365d78574a11.tar.bz2 sparse-10c21653c1648fb7619ebe8f9787365d78574a11.zip |
Simplify constant subtraction into addition.
We're much better at simplifying addition, so let's try to fix it
up.
Diffstat (limited to 'simplify.c')
-rw-r--r-- | simplify.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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) |