[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Mar 28 11:11:17 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.129 -> 1.130
---
Log message:
Don't crash on X^X if X is a vector. Instead, produce a vector of zeros.
---
Diffs of the changes: (+10 -2)
DAGCombiner.cpp | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.129 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.130
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.129 Sat Mar 25 16:19:00 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Mar 28 13:11:05 2006
@@ -1396,8 +1396,16 @@
DAG.getConstant(N1C->getValue()^N01C->getValue(), VT));
}
// fold (xor x, x) -> 0
- if (N0 == N1)
- return DAG.getConstant(0, VT);
+ if (N0 == N1) {
+ if (!MVT::isVector(VT)) {
+ return DAG.getConstant(0, VT);
+ } else if (!AfterLegalize || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)) {
+ // Produce a vector of zeros.
+ SDOperand El = DAG.getConstant(0, MVT::getVectorBaseType(VT));
+ std::vector<SDOperand> Ops(MVT::getVectorNumElements(VT), El);
+ return DAG.getNode(ISD::BUILD_VECTOR, VT, Ops);
+ }
+ }
// fold (xor (zext x), (zext y)) -> (zext (xor x, y))
if (N0.getOpcode() == ISD::ZERO_EXTEND &&
N1.getOpcode() == ISD::ZERO_EXTEND &&
More information about the llvm-commits
mailing list