[clang] [llvm] Pass TargetMachine from from Clang to `BitcodeWriter`and `ThinLTOBitcodeWriter` pass for thin and fat LTO respectively. (PR #143692)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 09:41:16 PDT 2025
================
@@ -568,31 +572,44 @@ bool writeThinLTOBitcode(raw_ostream &OS, raw_ostream *ThinLinkOS,
// produced for the full link.
ModuleHash ModHash = {{0}};
WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index,
- /*GenerateHash=*/true, &ModHash);
+ /*GenerateHash=*/true, &ModHash, TM);
// If a minimized bitcode module was requested for the thin link, only
// the information that is needed by thin link will be written in the
// given OS.
if (ThinLinkOS && Index)
- writeThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
+ writeThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash, TM);
return false;
}
} // anonymous namespace
PreservedAnalyses
llvm::ThinLTOBitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
- FunctionAnalysisManager &FAM =
- AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
-
M.removeDebugIntrinsicDeclarations();
+ FunctionAnalysisManager &FAM =
----------------
teresajohnson wrote:
Rather than doing all this restructuring of the current callers of ModuleSummaryIndexAnalysis, can you just change that analysis pass to take the TM? E.g. see CustomizedAnalysis in llvm-project/llvm/unittests/IR
/PassManagerTest.cpp, and its invocation [here](https://github.com/llvm/llvm-project/blob/1bd4f9719faac77f368a7bdfdb47ead56a808375/llvm/unittests/IR/PassManagerTest.cpp#L578)
https://github.com/llvm/llvm-project/pull/143692
More information about the llvm-commits
mailing list