[llvm] 314deab - Add Triple::isAMDGPU
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 22 11:21:09 PDT 2020
Author: Yaxun (Sam) Liu
Date: 2020-03-22T14:20:28-04:00
New Revision: 314deab9af94d3136c83b0b5cd32a6000f43bfee
URL: https://github.com/llvm/llvm-project/commit/314deab9af94d3136c83b0b5cd32a6000f43bfee
DIFF: https://github.com/llvm/llvm-project/commit/314deab9af94d3136c83b0b5cd32a6000f43bfee.diff
LOG: Add Triple::isAMDGPU
Differential Revision: https://reviews.llvm.org/D57707
Added:
Modified:
llvm/include/llvm/ADT/Triple.h
llvm/lib/Analysis/TargetLibraryInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index c136469eff54..9d9f4f8adb61 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -691,6 +691,10 @@ class Triple {
return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
}
+ bool isAMDGPU() const {
+ return getArch() == Triple::r600 || getArch() == Triple::amdgcn;
+ }
+
/// Tests whether the target is Thumb (little and big endian).
bool isThumb() const {
return getArch() == Triple::thumb || getArch() == Triple::thumbeb;
diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 3928fbd34476..fa4deea632d8 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -105,14 +105,12 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
TLI.setShouldExtI32Return(ShouldExtI32Return);
TLI.setShouldSignExtI32Param(ShouldSignExtI32Param);
- if (T.getArch() == Triple::r600 ||
- T.getArch() == Triple::amdgcn)
+ if (T.isAMDGPU())
TLI.disableAllFunctions();
// There are no library implementations of memcpy and memset for AMD gpus and
// these can be
diff icult to lower in the backend.
- if (T.getArch() == Triple::r600 ||
- T.getArch() == Triple::amdgcn) {
+ if (T.isAMDGPU()) {
TLI.setUnavailable(LibFunc_memcpy);
TLI.setUnavailable(LibFunc_memset);
TLI.setUnavailable(LibFunc_memset_pattern16);
More information about the llvm-commits
mailing list