Teach getTypeToTransformTo to return something
authorDuncan Sands <baldrick@free.fr>
Mon, 20 Oct 2008 16:24:25 +0000 (16:24 +0000)
committerDuncan Sands <baldrick@free.fr>
Mon, 20 Oct 2008 16:24:25 +0000 (16:24 +0000)
sensible for vectors being scalarized.  Note
that this method can't return anything very
sensible when splitting non-power-of-two vectors.

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

include/llvm/Target/TargetLowering.h

index 85e90af5adf20ebaf42af0483b3171172bbd3a26..2884ab7204008732fc173751e5d8fc1d4740a724 100644 (file)
@@ -209,10 +209,11 @@ public:
       return NVT;
     }
 
-    if (VT.isVector())
-      return MVT::getVectorVT(VT.getVectorElementType(),
-                              VT.getVectorNumElements() / 2);
-    if (VT.isInteger()) {
+    if (VT.isVector()) {
+      unsigned NumElts = VT.getVectorNumElements();
+      MVT EltVT = VT.getVectorElementType();
+      return (NumElts == 1) ? EltVT : MVT::getVectorVT(EltVT, NumElts / 2);
+    } else if (VT.isInteger()) {
       MVT NVT = VT.getRoundIntegerType();
       if (NVT == VT)
         // Size is a power of two - expand to half the size.