[clang] 36a1b51 - clang: Remove hacky OpenMP handling for appending bound arch (#201555)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 4 05:08:55 PDT 2026
Author: Matt Arsenault
Date: 2026-06-04T12:08:50Z
New Revision: 36a1b5156e94f2c07ee8eeabe710ab99fc1a5489
URL: https://github.com/llvm/llvm-project/commit/36a1b5156e94f2c07ee8eeabe710ab99fc1a5489
DIFF: https://github.com/llvm/llvm-project/commit/36a1b5156e94f2c07ee8eeabe710ab99fc1a5489.diff
LOG: clang: Remove hacky OpenMP handling for appending bound arch (#201555)
Use the same path as CUDA/HIP and stop doing a hacky search through
the arguments looking for -march.
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 25bf84a2bde33..eea0e67e67dd7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9312,28 +9312,11 @@ void OffloadBundler::ConstructJob(Compilation &C, const JobAction &JA,
Triples += '-';
Triples +=
CurTC->getTriple().normalize(llvm::Triple::CanonicalForm::FOUR_IDENT);
- if ((CurKind == Action::OFK_HIP || CurKind == Action::OFK_Cuda) &&
+ if (CurKind != Action::OFK_Host &&
!StringRef(CurDep->getOffloadingArch()).empty()) {
Triples += '-';
Triples += CurDep->getOffloadingArch();
}
-
- // TODO: Replace parsing of -march flag. Can be done by storing GPUArch
- // with each toolchain.
- StringRef GPUArchName;
- if (CurKind == Action::OFK_OpenMP) {
- // Extract GPUArch from -march argument in TC argument list.
- for (unsigned ArgIndex = 0; ArgIndex < TCArgs.size(); ArgIndex++) {
- auto ArchStr = StringRef(TCArgs.getArgString(ArgIndex));
- auto Arch = ArchStr.starts_with_insensitive("-march=");
- if (Arch) {
- GPUArchName = ArchStr.substr(7);
- Triples += "-";
- break;
- }
- }
- Triples += GPUArchName.str();
- }
}
CmdArgs.push_back(TCArgs.MakeArgString(Triples));
@@ -9407,28 +9390,11 @@ void OffloadBundler::ConstructJobMultipleOutputs(
Triples += '-';
Triples += Dep.DependentToolChain->getTriple().normalize(
llvm::Triple::CanonicalForm::FOUR_IDENT);
- if ((Dep.DependentOffloadKind == Action::OFK_HIP ||
- Dep.DependentOffloadKind == Action::OFK_Cuda) &&
+ if (Dep.DependentOffloadKind != Action::OFK_Host &&
!Dep.DependentBoundArch.empty()) {
Triples += '-';
Triples += Dep.DependentBoundArch;
}
- // TODO: Replace parsing of -march flag. Can be done by storing GPUArch
- // with each toolchain.
- StringRef GPUArchName;
- if (Dep.DependentOffloadKind == Action::OFK_OpenMP) {
- // Extract GPUArch from -march argument in TC argument list.
- for (unsigned ArgIndex = 0; ArgIndex < TCArgs.size(); ArgIndex++) {
- StringRef ArchStr = StringRef(TCArgs.getArgString(ArgIndex));
- auto Arch = ArchStr.starts_with_insensitive("-march=");
- if (Arch) {
- GPUArchName = ArchStr.substr(7);
- Triples += "-";
- break;
- }
- }
- Triples += GPUArchName.str();
- }
}
CmdArgs.push_back(TCArgs.MakeArgString(Triples));
More information about the cfe-commits
mailing list