aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-03-10 07:19:13 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-03-10 07:19:13 +0000
commitf79e60649a5edea03bdccf8521d77c15cbb33af4 (patch)
treeec61ba44f6cbfaaba814a8a2ab3ab859e8c906ac /lib
parent8d88dbcbae38ba4e6d7bd43dd499a13bf091999d (diff)
downloadexternal_llvm-f79e60649a5edea03bdccf8521d77c15cbb33af4.zip
external_llvm-f79e60649a5edea03bdccf8521d77c15cbb33af4.tar.gz
external_llvm-f79e60649a5edea03bdccf8521d77c15cbb33af4.tar.bz2
Avoid creating BUILD_VECTOR of all zero elements of "non-normalized" type (e.g. v8i16 on x86) after legalizer. Instruction selection does not expect to see them. In all likelihood this can only be an issue in a bugpoint reduced test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-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 963a1fe..1b00855 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)