[llvm] 06cdc6f - [LoongArch] Ignore warnings when there is no environment in triple
Weining Lu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 22:24:21 PDT 2023
Author: Wang Rui
Date: 2023-06-14T13:23:54+08:00
New Revision: 06cdc6f9ced3da478b30debd4f8698f7cac37819
URL: https://github.com/llvm/llvm-project/commit/06cdc6f9ced3da478b30debd4f8698f7cac37819
DIFF: https://github.com/llvm/llvm-project/commit/06cdc6f9ced3da478b30debd4f8698f7cac37819.diff
LOG: [LoongArch] Ignore warnings when there is no environment in triple
In Rust bare-metal targets, there is no environment component in triple name. This patch ignores warnings that look like:
```
warning: triple-implied ABI conflicts with provided target-abi ‘lp64s', using target-abi
```
Reviewed By: SixWeining, xen0n
Differential Revision: https://reviews.llvm.org/D152778
Added:
Modified:
llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
llvm/test/CodeGen/LoongArch/target-abi-from-triple-edge-cases.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
index 3b9ce9437d386..928adb03f0989 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.cpp
@@ -73,7 +73,7 @@ ABI computeTargetABI(const Triple &TT, StringRef ABIName) {
break;
}
- if (!ABIName.empty() && ArgProvidedABI != TripleABI)
+ if (!ABIName.empty() && TT.hasEnvironment() && ArgProvidedABI != TripleABI)
errs() << "warning: triple-implied ABI conflicts with provided target-abi '"
<< ABIName << "', using target-abi\n";
diff --git a/llvm/test/CodeGen/LoongArch/target-abi-from-triple-edge-cases.ll b/llvm/test/CodeGen/LoongArch/target-abi-from-triple-edge-cases.ll
index f30fcb8afeec2..1d5ed089c69fa 100644
--- a/llvm/test/CodeGen/LoongArch/target-abi-from-triple-edge-cases.ll
+++ b/llvm/test/CodeGen/LoongArch/target-abi-from-triple-edge-cases.ll
@@ -16,6 +16,13 @@
; CONFLICT-ILP32D: warning: triple-implied ABI conflicts with provided target-abi 'ilp32d', using target-abi
; CONFLICT-LP64D: warning: triple-implied ABI conflicts with provided target-abi 'lp64d', using target-abi
+;; Check that no warning is reported when there is no environment component in
+;; triple-supplied ABI modifiers and --target-abi is used.
+; RUN: llc --mtriple=loongarch64-linux --target-abi=lp64d --mattr=+d < %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=LP64D,NO-WARNING
+
+; NO-WARNING-NOT: warning: triple-implied ABI conflicts with provided target-abi 'lp64d', using target-abi
+
;; Check that ILP32-on-LA64 and LP64-on-LA32 combinations are handled properly.
; RUN: llc --mtriple=loongarch64 --target-abi=ilp32d --mattr=+d < %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=LP64D,32ON64
More information about the llvm-commits
mailing list