[libc-commits] [clang] [clang-tools-extra] [llvm] [libc] [compiler-rt] [libcxx] [flang] [LoongArch] Fixing the incorrect return value of LoongArchTTIImpl::getRegisterBitWidth (PR #79441)
via libc-commits
libc-commits at lists.llvm.org
Thu Jan 25 16:58:23 PST 2024
https://github.com/wangleiat updated https://github.com/llvm/llvm-project/pull/79441
>From 6231f5435a9735e6c9333c177f2e802a7ad1f901 Mon Sep 17 00:00:00 2001
From: wanglei <wanglei at loongson.cn>
Date: Thu, 25 Jan 2024 19:25:37 +0800
Subject: [PATCH] [LoongArch] Fixing the incorrect return value of
LoongArchTTIImpl::getRegisterBitWidth
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 from #78943.
https://lab.llvm.org/staging/#/builders/5
---
.../Target/LoongArch/LoongArchTargetTransformInfo.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
index 04349aa52b5408..d47dded9ea6ecf 100644
--- a/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchTargetTransformInfo.cpp
@@ -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");
More information about the libc-commits
mailing list