diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp --- a/llvm/lib/Analysis/LazyCallGraph.cpp +++ b/llvm/lib/Analysis/LazyCallGraph.cpp @@ -220,8 +220,7 @@ // Check whether the analysis, all analyses on functions, or the function's // CFG have been preserved. auto PAC = PA.getChecker(); - return !(PAC.preserved() || PAC.preservedSet>() || - PAC.preservedSet()); + return !(PAC.preserved() || PAC.preservedSet>()); } LazyCallGraph &LazyCallGraph::operator=(LazyCallGraph &&G) { diff --git a/llvm/test/Analysis/LazyCallGraph/invalidate.ll b/llvm/test/Analysis/LazyCallGraph/invalidate.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Analysis/LazyCallGraph/invalidate.ll @@ -0,0 +1,10 @@ +; Make sure we invalidate lcg even when preserving domtree +; RUN: opt -passes='require,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 +}