Skip to content

Commit bc2fe6c

Browse files
committed
Fix crash from [CGData] Global Merge Functions (llvm#112671)
1 parent 6b99527 commit bc2fe6c

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
@@ -637,7 +637,6 @@ bool GlobalMergeFuncPassWrapper::runOnModule(Module &M) {
637637

638638
PreservedAnalyses GlobalMergeFuncPass::run(Module &M,
639639
AnalysisManager<Module> &AM) {
640-
ModuleSummaryIndex *Index = &(AM.getResult<ModuleSummaryIndexAnalysis>(M));
641-
bool Changed = GlobalMergeFunc(Index).run(M);
640+
bool Changed = GlobalMergeFunc(ImportSummary).run(M);
642641
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
643642
}

0 commit comments

Comments
 (0)