[llvm-commits] [llvm] r48170 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Evan Cheng evan.cheng at apple.com
Mon Mar 10 12:58:29 PDT 2008


Author: evancheng
Date: Mon Mar 10 14:58:22 2008
New Revision: 48170

URL: http://llvm.org/viewvc/llvm-project?rev=48170&view=rev
Log:
Somewhat better solution.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=48170&r1=48169&r2=48170&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Mar 10 14:58:22 2008
@@ -1103,9 +1103,10 @@
   
   // 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));
   }





More information about the llvm-commits mailing list