[clang] [flang] [llvm] [NFC][AMDGPU] Replace more direct arch comparison with isAMDGCN() (PR #131379)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 14 12:12:15 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 7598ceaf51e0fa726bcd50a251f86435d871ee70 59bc234d4a5c343e093417150688a3231a230961 --extensions h,cpp -- clang/include/clang/Driver/ToolChain.h clang/lib/Basic/Targets/AMDGPU.h clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/HIPAMD.cpp clang/lib/Frontend/CompilerInvocation.cpp flang/lib/Frontend/CompilerInvocation.cpp llvm/include/llvm/TargetParser/Triple.h llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Basic/Targets/AMDGPU.h b/clang/lib/Basic/Targets/AMDGPU.h
index 9bee541cfd..63b0d4b6e5 100644
--- a/clang/lib/Basic/Targets/AMDGPU.h
+++ b/clang/lib/Basic/Targets/AMDGPU.h
@@ -62,9 +62,7 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
}
/// Has fast fma f64
- bool hasFastFMA() const {
- return getTriple().isAMDGCN();
- }
+ bool hasFastFMA() const { return getTriple().isAMDGCN(); }
bool hasFMAF() const {
return getTriple().isAMDGCN() ||
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 0ae61fdd0d..056bfcf1b7 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3408,8 +3408,7 @@ class OffloadingActionBuilder final {
const ToolChain *HostTC = C.getSingleOffloadToolChain<Action::OFK_Host>();
assert(HostTC && "No toolchain for host compilation.");
- if (HostTC->getTriple().isNVPTX() ||
- HostTC->getTriple().isAMDGCN()) {
+ if (HostTC->getTriple().isNVPTX() || HostTC->getTriple().isAMDGCN()) {
// We do not support targeting NVPTX/AMDGCN for host compilation. Throw
// an error and abort pipeline construction early so we don't trip
// asserts that assume device-side compilation.
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 8c38acad0c..e708bee464 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4322,8 +4322,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
TT.getArch() == llvm::Triple::systemz ||
TT.getArch() == llvm::Triple::loongarch64 ||
TT.getArch() == llvm::Triple::nvptx ||
- TT.getArch() == llvm::Triple::nvptx64 ||
- TT.isAMDGCN() ||
+ TT.getArch() == llvm::Triple::nvptx64 || TT.isAMDGCN() ||
TT.getArch() == llvm::Triple::x86 ||
TT.getArch() == llvm::Triple::x86_64))
Diags.Report(diag::err_drv_invalid_omp_target) << A->getValue(i);
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index de8a3bfb8b..f433ec9966 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1174,8 +1174,7 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
!(tt.getArch() == llvm::Triple::aarch64 || tt.isPPC() ||
tt.getArch() == llvm::Triple::systemz ||
tt.getArch() == llvm::Triple::nvptx ||
- tt.getArch() == llvm::Triple::nvptx64 ||
- tt.isAMDGCN() ||
+ tt.getArch() == llvm::Triple::nvptx64 || tt.isAMDGCN() ||
tt.getArch() == llvm::Triple::x86 ||
tt.getArch() == llvm::Triple::x86_64))
diags.Report(clang::diag::err_drv_invalid_omp_target)
``````````
</details>
https://github.com/llvm/llvm-project/pull/131379
More information about the llvm-commits
mailing list