Skip to content

Commit 900e7cb

Browse files
wangleiattstellar
authored andcommitted
[LoongArch] Fixing the incorrect return value of LoongArchTTIImpl::getRegisterBitWidth (llvm#79441)
When we do not enable vector features, we should return the default value (`TargetTransformInfoImplBase::getRegisterBitWidth`) instead of zero. This should fix the LoongArch [buildbot breakage](https://lab.llvm.org/staging/#/builders/5/builds/486) from llvm#78943. (cherry picked from commit 1e9924c)
1 parent ae04671 commit 900e7cb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ using namespace llvm;
2121

2222
TypeSize LoongArchTTIImpl::getRegisterBitWidth(
2323
TargetTransformInfo::RegisterKind K) const {
24+
TypeSize DefSize = TargetTransformInfoImplBase::getRegisterBitWidth(K);
2425
switch (K) {
2526
case TargetTransformInfo::RGK_Scalar:
2627
return TypeSize::getFixed(ST->is64Bit() ? 64 : 32);
2728
case TargetTransformInfo::RGK_FixedWidthVector:
28-
if (ST->hasExtLASX() && ST->hasExpAutoVec())
29+
if (!ST->hasExpAutoVec())
30+
return DefSize;
31+
if (ST->hasExtLASX())
2932
return TypeSize::getFixed(256);
30-
if (ST->hasExtLSX() && ST->hasExpAutoVec())
33+
if (ST->hasExtLSX())
3134
return TypeSize::getFixed(128);
32-
return TypeSize::getFixed(0);
35+
[[fallthrough]];
3336
case TargetTransformInfo::RGK_ScalableVector:
34-
return TypeSize::getScalable(0);
37+
return DefSize;
3538
}
3639

3740
llvm_unreachable("Unsupported register kind");

0 commit comments

Comments
 (0)