[llvm] LoongArch: Improve detection of valid TripleABI (PR #147952)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 10 05:53:14 PDT 2025
https://github.com/mintsuki updated https://github.com/llvm/llvm-project/pull/147952
>From 34376aff10060c30e0832b0a0f26c641573f8592 Mon Sep 17 00:00:00 2001
From: Mintsuki <mintsuki at protonmail.com>
Date: Thu, 10 Jul 2025 14:37:07 +0200
Subject: [PATCH] LoongArch: Improve detection of valid TripleABI
Addresses issue #147665
---
.../Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
index 03ce004ed33a5..e9bf487ca4bba 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
@@ -60,11 +60,12 @@ static ABI getTripleABI(const Triple &TT) {
case llvm::Triple::EnvironmentType::MuslF32:
TripleABI = Is64Bit ? ABI_LP64F : ABI_ILP32F;
break;
- // Let the fallback case behave like {ILP32,LP64}D.
case llvm::Triple::EnvironmentType::GNUF64:
- default:
TripleABI = Is64Bit ? ABI_LP64D : ABI_ILP32D;
break;
+ default:
+ TripleABI = ABI_Unknown;
+ break;
}
return TripleABI;
}
@@ -96,7 +97,7 @@ ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits,
// 1. If the '-target-abi' is valid, use it.
if (IsABIValidForFeature(ArgProvidedABI)) {
- if (TT.hasEnvironment() && ArgProvidedABI != TripleABI)
+ if (IsABIValidForFeature(TripleABI) && ArgProvidedABI != TripleABI)
errs()
<< "warning: triple-implied ABI conflicts with provided target-abi '"
<< ABIName << "', using target-abi\n";
More information about the llvm-commits
mailing list