summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TargetLoweringBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringBase.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 982e3185467..b9d67389145 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1282,21 +1282,33 @@ void TargetLoweringBase::computeRegisterProperties(
LLVM_FALLTHROUGH;
case TypeWidenVector:
- // Try to widen the vector.
- for (unsigned nVT = i + 1; nVT <= MVT::LAST_VECTOR_VALUETYPE; ++nVT) {
- MVT SVT = (MVT::SimpleValueType) nVT;
- if (SVT.getVectorElementType() == EltVT
- && SVT.getVectorNumElements() > NElts && isTypeLegal(SVT)) {
- TransformToType[i] = SVT;
- RegisterTypeForVT[i] = SVT;
- NumRegistersForVT[i] = 1;
+ if (isPowerOf2_32(NElts)) {
+ // Try to widen the vector.
+ for (unsigned nVT = i + 1; nVT <= MVT::LAST_VECTOR_VALUETYPE; ++nVT) {
+ MVT SVT = (MVT::SimpleValueType) nVT;
+ if (SVT.getVectorElementType() == EltVT
+ && SVT.getVectorNumElements() > NElts && isTypeLegal(SVT)) {
+ TransformToType[i] = SVT;
+ RegisterTypeForVT[i] = SVT;
+ NumRegistersForVT[i] = 1;
+ ValueTypeActions.setTypeAction(VT, TypeWidenVector);
+ IsLegalWiderType = true;
+ break;
+ }
+ }
+ if (IsLegalWiderType)
+ break;
+ } else {
+ // Only widen to the next power of 2 to keep consistency with EVT.
+ MVT NVT = VT.getPow2VectorType();
+ if (isTypeLegal(NVT)) {
+ TransformToType[i] = NVT;
ValueTypeActions.setTypeAction(VT, TypeWidenVector);
- IsLegalWiderType = true;
+ RegisterTypeForVT[i] = NVT;
+ NumRegistersForVT[i] = 1;
break;
}
}
- if (IsLegalWiderType)
- break;
LLVM_FALLTHROUGH;
case TypeSplitVector:
OpenPOWER on IntegriCloud