From 62fcc41d958bf9b8cee43271789136cb7100705f Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Mon, 10 Mar 2008 19:58:22 +0000 Subject: [PATCH] Somewhat better solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48170 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 5cda144c92d..45929713369 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)); } -- 2.11.0