forked from OSchip/llvm-project
[LCG] Don't skip invalidation of LazyCallGraph if CFG analyses are preserved
The CFG being changed and the overall call graph are not related, we can introduce/remove calls without changing the CFG. Resolves one of the issues in PR51946. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D111275
This commit is contained in:
parent
59441c7329
commit
259390de9a
|
@ -220,8 +220,7 @@ bool LazyCallGraph::invalidate(Module &, const PreservedAnalyses &PA,
|
|||
// Check whether the analysis, all analyses on functions, or the function's
|
||||
// CFG have been preserved.
|
||||
auto PAC = PA.getChecker<llvm::LazyCallGraphAnalysis>();
|
||||
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>() ||
|
||||
PAC.preservedSet<CFGAnalyses>());
|
||||
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>());
|
||||
}
|
||||
|
||||
LazyCallGraph &LazyCallGraph::operator=(LazyCallGraph &&G) {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
; Make sure we invalidate lcg even when preserving domtree
|
||||
; RUN: opt -passes='require<lcg>,function(instcombine)' -debug-pass-manager -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: Invalidating {{.*}} LazyCallGraphAnalysis
|
||||
|
||||
define void @f() {
|
||||
lbl:
|
||||
%a = add i32 1, 2
|
||||
unreachable
|
||||
}
|
Loading…
Reference in New Issue