[clang] clang: Use correct triple when constructing offload bundler command (PR #195271)

via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 07:23:13 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/195271.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChains/HIPUtility.cpp (+3-3) 


``````````diff
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();
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/195271


More information about the cfe-commits mailing list