aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-06-02 22:27:05 +0000
committerDan Gohman <gohman@apple.com>2008-06-02 22:27:05 +0000
commit33b625bee429986b2b3bd11108816d256df39334 (patch)
treedbb00636abdd301a3c92edc91b557f4601e997c3 /lib
parent83ccc0a50c7c52b2d774c3f4d209a120800ecdc7 (diff)
downloadexternal_llvm-33b625bee429986b2b3bd11108816d256df39334.zip
external_llvm-33b625bee429986b2b3bd11108816d256df39334.tar.gz
external_llvm-33b625bee429986b2b3bd11108816d256df39334.tar.bz2
Fold adds and subtracts of zero immediately, instead of waiting
for dagcombine to do this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51886 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index c8f5d53..a9b7381 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2115,10 +2115,12 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
break;
case ISD::OR:
case ISD::XOR:
+ case ISD::ADD:
+ case ISD::SUB:
assert(MVT::isInteger(VT) && N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!");
- // (X ^| 0) -> X. This commonly occurs when legalizing i64 values, so it's
- // worth handling here.
+ // (X ^|+- 0) -> X. This commonly occurs when legalizing i64 values, so
+ // it's worth handling here.
if (N2C && N2C->isNullValue())
return N1;
break;
@@ -2128,8 +2130,6 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
case ISD::MULHS:
assert(MVT::isInteger(VT) && "This operator does not apply to FP types!");
// fall through
- case ISD::ADD:
- case ISD::SUB:
case ISD::MUL:
case ISD::SDIV:
case ISD::SREM: