[llvm] Fix crash from [CGData] Global Merge Functions (#112671) (PR #116241)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 15 06:55:38 PST 2024


================
@@ -666,7 +666,6 @@ bool GlobalMergeFuncPassWrapper::runOnModule(Module &M) {
 
 PreservedAnalyses GlobalMergeFuncPass::run(Module &M,
                                            AnalysisManager<Module> &AM) {
-  ModuleSummaryIndex *Index = &(AM.getResult<ModuleSummaryIndexAnalysis>(M));
-  bool Changed = GlobalMergeFunc(Index).run(M);
+  bool Changed = GlobalMergeFunc(ImportSummary).run(M);
----------------
kyulee-com wrote:

This pass only uses this combined summary to determine if it's a LTO mode -- https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/GlobalMergeFunctions.cpp#L539-L542.

Currently, this pass is utilized in a pre-codegen pass that employs the legacy `createGlobalMergeFuncPass()`. As per the review comment, I have also incorporated an option for the new pass manager, `GlobalMergeFuncPass()`. If we intend to use this with the typical new PM, such as `buildThinLTODefaultPipeline()`, it is necessary to pass `ImportSummary` to the constructor.

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


More information about the llvm-commits mailing list