Make sure to pass enough values to phi nodes when we are dealing with
authorChris Lattner <sabre@nondot.org>
Fri, 31 Mar 2006 02:12:18 +0000 (02:12 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 31 Mar 2006 02:12:18 +0000 (02:12 +0000)
decimated vectors.  This fixes UnitTests/Vector/sumarray-dbl.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27280 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 0b32352c689ae3da9cee0445fa238cb47fd11da2..1d05087b2a6ced2ae8823b170516a5301718564b 100644 (file)
@@ -2805,8 +2805,16 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
 
         // Remember that this register needs to added to the machine PHI node as
         // the input for this MBB.
-        unsigned NumElements =
-          TLI.getNumElements(TLI.getValueType(PN->getType()));
+        MVT::ValueType VT = TLI.getValueType(PN->getType());
+        unsigned NumElements;
+        if (VT != MVT::Vector)
+          NumElements = TLI.getNumElements(VT);
+        else {
+          MVT::ValueType VT1,VT2;
+          NumElements = 
+            TLI.getPackedTypeBreakdown(cast<PackedType>(PN->getType()),
+                                       VT1, VT2);
+        }
         for (unsigned i = 0, e = NumElements; i != e; ++i)
           PHINodesToUpdate.push_back(std::make_pair(MBBI++, Reg+i));
       }