Skip to content

Commit

Permalink
[LoongArch] Fixing the incorrect return value of LoongArchTTIImpl::ge…
Browse files Browse the repository at this point in the history
…tRegisterBitWidth (#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
#78943.

(cherry picked from commit 1e9924c)
  • Loading branch information
wangleiat authored and tstellar committed Feb 4, 2024
1 parent ae04671 commit 900e7cb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ using namespace llvm;

TypeSize LoongArchTTIImpl::getRegisterBitWidth(
TargetTransformInfo::RegisterKind K) const {
TypeSize DefSize = TargetTransformInfoImplBase::getRegisterBitWidth(K);
switch (K) {
case TargetTransformInfo::RGK_Scalar:
return TypeSize::getFixed(ST->is64Bit() ? 64 : 32);
case TargetTransformInfo::RGK_FixedWidthVector:
if (ST->hasExtLASX() && ST->hasExpAutoVec())
if (!ST->hasExpAutoVec())
return DefSize;
if (ST->hasExtLASX())
return TypeSize::getFixed(256);
if (ST->hasExtLSX() && ST->hasExpAutoVec())
if (ST->hasExtLSX())
return TypeSize::getFixed(128);
return TypeSize::getFixed(0);
[[fallthrough]];
case TargetTransformInfo::RGK_ScalableVector:
return TypeSize::getScalable(0);
return DefSize;
}

llvm_unreachable("Unsupported register kind");
Expand Down

0 comments on commit 900e7cb

Please sign in to comment.