aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 963a1feba8..1b00855a67 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1103,6 +1103,10 @@ SDOperand DAGCombiner::visitSUB(SDNode *N) {
// fold (sub x, x) -> 0
if (N0 == N1)
+ if (ISD::isBuildVectorAllZeros(N0.Val))
+ // Zero vectors might be normalized to a particular vector type to ensure
+ // they are CSE'd. Return it as it is.
+ return N0;
return DAG.getConstant(0, N->getValueType(0));
// fold (sub c1, c2) -> c1-c2
if (N0C && N1C)