Skip to content

Commit

Permalink
Fix crash from [CGData] Global Merge Functions (llvm#112671)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyulee-com committed Nov 15, 2024
1 parent 3eb1bc5 commit 2138d8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class GlobalMergeFunc {

/// Global function merging pass for new pass manager.
struct GlobalMergeFuncPass : public PassInfoMixin<GlobalMergeFuncPass> {
const ModuleSummaryIndex *ImportSummary = nullptr;
GlobalMergeFuncPass() = default;
GlobalMergeFuncPass(const ModuleSummaryIndex *ImportSummary)
: ImportSummary(ImportSummary) {}
PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
};

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/GlobalMergeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,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);
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
}

0 comments on commit 2138d8a

Please sign in to comment.