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/DAGCombiner.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/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 2229743b92..e24a2942dd 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2119,6 +2119,9 @@ SDOperand DAGCombiner::visitXOR(SDNode *N) { if (FoldedVOp.Val) return FoldedVOp; } + // fold (xor undef, undef) -> 0. This is a common idiom (misuse). + if (N0.getOpcode() == ISD::UNDEF && N1.getOpcode() == ISD::UNDEF) + return DAG.getConstant(0, VT); // fold (xor x, undef) -> undef if (N0.getOpcode() == ISD::UNDEF) return N0; |