[llvm-branch-commits] [clang] [llvm] clang: Use TargetID parsing from AMDGPUTargetParser (PR #209845)

Yaxun Liu via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 17 08:22:45 PDT 2026


================
@@ -1537,8 +1524,17 @@ CheckHeterogeneousArchive(StringRef ArchiveName,
     if (CodeObjectFileError)
       return CodeObjectFileError;
 
-    auto &&ConflictingArchs = clang::getConflictTargetIDCombination(BundleIds);
-    if (ConflictingArchs) {
+    // A single bundle may contain several triples. Pair each target ID with its
+    // own triple; the conflict check groups by resolved processor, which is
+    // spelling-independent.
+    llvm::SmallVector<clang::TargetIDEntry> Entries;
+    for (StringRef BundleId : BundleIds) {
+      OffloadTargetInfo Info(BundleId, BundlerConfig);
+      Entries.emplace_back(Info.Triple, Info.TargetID);
----------------
yxsamliu wrote:

`TargetIDEntry` stores the `Triple` by reference, but here the reference points to `Info.Triple` from a loop-local `OffloadTargetInfo`. After each iteration, `Info` is destroyed, so `Entries` contains dangling references when `getConflictTargetIDCombination` is called. Could we make `TargetIDEntry` own the `Triple`, or keep the `OffloadTargetInfo` objects alive until after the conflict check?

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


More information about the llvm-branch-commits mailing list