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

Nadav Rotem nadav.rotem at intel.com
Fri Feb 11 11:20:38 PST 2011


Author: nadav
Date: Fri Feb 11 13:20:37 2011
New Revision: 125391

URL: http://llvm.org/viewvc/llvm-project?rev=125391&view=rev
Log:

Fix #9190

The bug happens when the DAGCombiner attempts to optimize one of the patterns
of the SUB opcode. It tries to create a zero of type v2i64. This type is legal
on 32bit machines, but the initializer of this vector (i64) is target dependent.
Currently, the initializer attempts to create an i64 zero constant, which fails.
Added a flag to tell the DAGCombiner to create a legal zero, if we require that
the pass would generate legal types.


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=125391&r1=125390&r2=125391&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 11 13:20:37 2011
@@ -1533,7 +1533,7 @@
 
   // fold (sub x, x) -> 0
   if (N0 == N1)
-    return DAG.getConstant(0, N->getValueType(0));
+    return DAG.getConstant(0, N->getValueType(0), LegalTypes);
   // fold (sub c1, c2) -> c1-c2
   if (N0C && N1C)
     return DAG.FoldConstantArithmetic(ISD::SUB, VT, N0C, N1C);





More information about the llvm-commits mailing list