aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-03-10 19:58:22 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-03-10 19:58:22 +0000
commitcf31b8d763edf30c4d8cb9080de2c81a3764ef09 (patch)
tree55a9f4f7c0219a2a9fc535642ff4360960e03580 /lib/CodeGen
parent8d51ab3e4bb3f45ab8818519c5d27154cecf8b72 (diff)
downloadexternal_llvm-cf31b8d763edf30c4d8cb9080de2c81a3764ef09.zip
external_llvm-cf31b8d763edf30c4d8cb9080de2c81a3764ef09.tar.gz
external_llvm-cf31b8d763edf30c4d8cb9080de2c81a3764ef09.tar.bz2
Somewhat better solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48170 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 5cda144..4592971 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1103,9 +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.
+ if (!AfterLegalize || !MVT::isVector(VT))
+ // For example, zero vectors might be normalized to a particular vector
+ // type to ensure they are CSE'd. Avoid issuing zero vector nodes of
+ // *unexpected* type after legalization.
return N0;
return DAG.getConstant(0, N->getValueType(0));
}