diff options
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 85e90af5ad..2884ab7204 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -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. |