[clang] clang: Remove hacky OpenMP handling for appending bound arch (PR #201555)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 4 04:35:33 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/201555
Use the same path as CUDA/HIP and stop doing a hacky search through
the arguments looking for -march.
>From 87c084141591fbbc54b7aad8f1ace374fcd5b290 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Thu, 4 Jun 2026 13:33:27 +0200
Subject: [PATCH] clang: Remove hacky OpenMP handling for appending bound arch
Use the same path as CUDA/HIP and stop doing a hacky search through
the arguments looking for -march.
---
clang/lib/Driver/ToolChains/Clang.cpp | 38 ++-------------------------
1 file changed, 2 insertions(+), 36 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 7657afb14f077..727bc74450e32 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9322,28 +9322,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));
@@ -9417,28 +9400,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