Skip to content

Commit c24e064

Browse files
committed
Fix crash from [CGData] Global Merge Functions (#112671)
1 parent 4cdfa2a commit c24e064

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/include/llvm/CodeGen/GlobalMergeFunctions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class GlobalMergeFunc {
7878

7979
/// Global function merging pass for new pass manager.
8080
struct GlobalMergeFuncPass : public PassInfoMixin<GlobalMergeFuncPass> {
81+
const ModuleSummaryIndex *ImportSummary = nullptr;
82+
GlobalMergeFuncPass() = default;
83+
GlobalMergeFuncPass(const ModuleSummaryIndex *ImportSummary)
84+
: ImportSummary(ImportSummary) {}
8185
PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
8286
};
8387

llvm/lib/CodeGen/GlobalMergeFunctions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ bool GlobalMergeFuncPassWrapper::runOnModule(Module &M) {
666666

667667
PreservedAnalyses GlobalMergeFuncPass::run(Module &M,
668668
AnalysisManager<Module> &AM) {
669-
ModuleSummaryIndex *Index = &(AM.getResult<ModuleSummaryIndexAnalysis>(M));
670-
bool Changed = GlobalMergeFunc(Index).run(M);
669+
bool Changed = GlobalMergeFunc(ImportSummary).run(M);
671670
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
672671
}

0 commit comments

Comments
 (0)