[llvm-commits] [llvm] r40598 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/Alpha/illegal-element-type.ll test/CodeGen/PowerPC/illegal-element-type.ll

Dan Gohman djg at cray.com
Mon Jul 30 14:09:17 CDT 2007


Author: djg
Date: Mon Jul 30 14:09:17 2007
New Revision: 40598

URL: http://llvm.org/viewvc/llvm-project?rev=40598&view=rev
Log:
Fix a bug in getCopyFromParts turned up in the testcase for PR1132.

Added:
    llvm/trunk/test/CodeGen/Alpha/illegal-element-type.ll
    llvm/trunk/test/CodeGen/PowerPC/illegal-element-type.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

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

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jul 30 14:09:17 2007
@@ -695,9 +695,9 @@
   } else if (NumParts > 0) {
     // If the intermediate type was expanded, build the intermediate operands
     // from the parts.
-    assert(NumIntermediates % NumParts == 0 &&
+    assert(NumParts % NumIntermediates == 0 &&
            "Must expand into a divisible number of parts!");
-    unsigned Factor = NumIntermediates / NumParts;
+    unsigned Factor = NumParts / NumIntermediates;
     for (unsigned i = 0; i != NumIntermediates; ++i)
       Ops[i] = getCopyFromParts(DAG, &Parts[i * Factor], Factor,
                                 PartVT, IntermediateVT);
@@ -708,7 +708,7 @@
   return DAG.getNode(MVT::isVector(IntermediateVT) ?
                        ISD::CONCAT_VECTORS :
                        ISD::BUILD_VECTOR,
-                     ValueVT, &Ops[0], NumParts);
+                     ValueVT, &Ops[0], NumIntermediates);
 }
 
 /// getCopyToParts - Create a series of nodes that contain the

Added: llvm/trunk/test/CodeGen/Alpha/illegal-element-type.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Alpha/illegal-element-type.ll?rev=40598&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/Alpha/illegal-element-type.ll (added)
+++ llvm/trunk/test/CodeGen/Alpha/illegal-element-type.ll Mon Jul 30 14:09:17 2007
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | llc -mtriple=alphaev6-unknown-linux-gnu
+
+define void @foo() {
+entry:
+        br label %bb
+
+bb:             ; preds = %bb, %entry
+        br i1 false, label %bb26, label %bb
+
+bb19:           ; preds = %bb26
+        ret void
+
+bb26:           ; preds = %bb
+        br i1 false, label %bb30, label %bb19
+
+bb30:           ; preds = %bb26
+        br label %bb45
+
+bb45:           ; preds = %bb45, %bb30
+        %V.0 = phi <8 x i16> [ %tmp42, %bb45 ], [ zeroinitializer, %bb30 ]     ; <<8 x i16>> [#uses=1]
+        %tmp42 = mul <8 x i16> zeroinitializer, %V.0            ; <<8 x i16>> [#uses=1]
+        br label %bb45
+}

Added: llvm/trunk/test/CodeGen/PowerPC/illegal-element-type.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/illegal-element-type.ll?rev=40598&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/illegal-element-type.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/illegal-element-type.ll Mon Jul 30 14:09:17 2007
@@ -0,0 +1,23 @@
+; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g3
+
+define void @foo() {
+entry:
+        br label %bb
+
+bb:             ; preds = %bb, %entry
+        br i1 false, label %bb26, label %bb
+
+bb19:           ; preds = %bb26
+        ret void
+
+bb26:           ; preds = %bb
+        br i1 false, label %bb30, label %bb19
+
+bb30:           ; preds = %bb26
+        br label %bb45
+
+bb45:           ; preds = %bb45, %bb30
+        %V.0 = phi <8 x i16> [ %tmp42, %bb45 ], [ zeroinitializer, %bb30 ]     ; <<8 x i16>> [#uses=1]
+        %tmp42 = mul <8 x i16> zeroinitializer, %V.0            ; <<8 x i16>> [#uses=1]
+        br label %bb45
+}





More information about the llvm-commits mailing list