[clang] [lld] [llvm] [LTO][LLD] Prevent invalid LTO libfunc transforms (PR #164916)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 15:59:58 PST 2025


================
@@ -2701,14 +2701,30 @@ static void markBuffersAsDontNeed(Ctx &ctx, bool skipLinkedOutput) {
 template <class ELFT>
 void LinkerDriver::compileBitcodeFiles(bool skipLinkedOutput) {
   llvm::TimeTraceScope timeScope("LTO");
+  // Capture the triple before moving the bitcode into the bitcode compiler.
+  // Note that this assumes that the set of possible libfuncs is roughly
+  // equivalent for all bitcode translation units.
+  std::optional<llvm::Triple> tt;
+  if (!ctx.bitcodeFiles.empty())
+    tt = llvm::Triple(ctx.bitcodeFiles.front()->obj->getTargetTriple());
----------------
ilovepi wrote:

can't all of this just move into the block below? I think you also can drop the optional, right, since if you only do this in that block there *has* to be a triple of some kind...

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


More information about the llvm-commits mailing list