[llvm] Fix crash from [CGData] Global Merge Functions (#112671) (PR #116241)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 07:20:23 PST 2024
https://github.com/kyulee-com updated https://github.com/llvm/llvm-project/pull/116241
>From 3ef07d6c031da8f1dcca0569bacc067f88309f11 Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
Date: Thu, 14 Nov 2024 07:03:53 -0800
Subject: [PATCH] Fix crash from [CGData] Global Merge Functions (#112671)
---
llvm/include/llvm/CodeGen/GlobalMergeFunctions.h | 4 ++++
llvm/lib/CodeGen/GlobalMergeFunctions.cpp | 3 +--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h b/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
index 82239e04dbd4fd..caea5b62851ea6 100644
--- a/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
+++ b/llvm/include/llvm/CodeGen/GlobalMergeFunctions.h
@@ -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> &);
};
diff --git a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
index 2b367ca87d9008..0e109bcdc7b616 100644
--- a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
+++ b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
@@ -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);
return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
}
More information about the llvm-commits
mailing list