diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-03-25 20:08:07 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-03-25 20:08:07 +0000 |
commit | 26471c48b3d49bdbcfcc05cb9a575b5fa123fbbf (patch) | |
tree | cf75442b4cf9f93ed3b27eef5bd8a601353c94b9 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | d34af7875b682d519038295b04ab4e15f237ccdf (diff) |
Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 05f7edb47c..ed564b2b7b 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2245,6 +2245,12 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, // Fold a bunch of operators when the RHS is undef. if (N2.getOpcode() == ISD::UNDEF) { switch (Opcode) { + case ISD::XOR: + if (N1.getOpcode() == ISD::UNDEF) + // Handle undef ^ undef -> 0 special case. This is a common + // idiom (misuse). + return getConstant(0, VT); + // fallthrough case ISD::ADD: case ISD::ADDC: case ISD::ADDE: @@ -2258,7 +2264,6 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, case ISD::SDIV: case ISD::UREM: case ISD::SREM: - case ISD::XOR: return N2; // fold op(arg1, undef) -> undef case ISD::MUL: case ISD::AND: |