[clang] clang: Use correct triple when constructing offload bundler command (PR #195271)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Fri May 1 07:22:18 PDT 2026
https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/195271
Use the toolchain triple for the particular input instead of the top
level toolchain. NFC for now, but avoids mismatched triples in
a future change.
>From a3afdb1e6bf351bb48518f8a52213a03d8eb8611 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 1 May 2026 15:10:53 +0100
Subject: [PATCH] clang: Use correct triple when constructing offload bundler
command
Use the toolchain triple for the particular input instead of the top
level toolchain. NFC for now, but avoids mismatched triples in
a future change.
---
clang/lib/Driver/ToolChains/HIPUtility.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp
index 3bf0f23409f9f..964eec6bb5866 100644
--- a/clang/lib/Driver/ToolChains/HIPUtility.cpp
+++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -301,8 +301,8 @@ void HIP::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
// for backward compatibility. For code object version 4 and greater, the
// offload kind in bundle ID is 'hipv4'.
std::string OffloadKind = "hip";
- auto &TT = T.getToolChain().getTriple();
- if (TT.isAMDGCN() && getAMDGPUCodeObjectVersion(C.getDriver(), Args) >= 4)
+ if (T.getToolChain().getTriple().isAMDGCN() &&
+ getAMDGPUCodeObjectVersion(C.getDriver(), Args) >= 4)
OffloadKind = OffloadKind + "v4";
for (const auto &II : Inputs) {
const auto *A = II.getAction();
@@ -312,7 +312,7 @@ void HIP::constructHIPFatbinCommand(Compilation &C, const JobAction &JA,
BundlerTargetArg +=
normalizeForBundler(llvm::Triple("spirv64-amd-amdhsa"), true);
else
- BundlerTargetArg += normalizeForBundler(TT, !ArchStr.empty());
+ BundlerTargetArg += normalizeForBundler(InputTriple, !ArchStr.empty());
if (!ArchStr.empty())
BundlerTargetArg += '-' + ArchStr.str();
}
More information about the cfe-commits
mailing list