[PATCH] D111275: [LCG] Don't skip invalidation of LazyCallGraph if CFG analyses are preserved
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 6 14:33:27 PDT 2021
aeubanks created this revision.
aeubanks added reviewers: mtrofin, asbirlea.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111275
Files:
llvm/lib/Analysis/LazyCallGraph.cpp
llvm/test/Analysis/LazyCallGraph/invalidate.ll
Index: llvm/test/Analysis/LazyCallGraph/invalidate.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/LazyCallGraph/invalidate.ll
@@ -0,0 +1,33 @@
+; REQUIRES: x86-registered-target
+; RUN: opt -passes='cgscc(no-op-cgscc),function(slp-vectorizer),cgscc(function(sroa))' -debug-pass-manager < %s 2>&1 | FileCheck %s
+
+; CHECK: Invalidating {{.*}} LazyCallGraph
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define i16 @my_lookup() {
+entry:
+ %lbl_addrs = alloca [3 x i8*], align 1
+ store i8* blockaddress(@my_lookup, %lbl2), i8** undef, align 1
+ %arrayinit.element1 = getelementptr inbounds i8*, i8** undef, i32 1
+ store i8* blockaddress(@my_lookup, %lbl3), i8** %arrayinit.element1, align 1
+ callbr void asm sideeffect "bra $0", "a,X,X,X"(i8* undef, i8* blockaddress(@my_lookup, %lbl1), i8* blockaddress(@my_lookup, %lbl2), i8* blockaddress(@my_lookup, %lbl3))
+ to label %asm.fallthrough [label %lbl1, label %lbl2, label %lbl3]
+
+asm.fallthrough: ; preds = %entry
+ unreachable
+
+lbl1: ; preds = %entry
+ ret i16 undef
+
+lbl2: ; preds = %entry
+ unreachable
+
+lbl3: ; preds = %entry
+ unreachable
+}
+
+define void @idi() {
+entry:
+ ret void
+}
Index: llvm/lib/Analysis/LazyCallGraph.cpp
===================================================================
--- llvm/lib/Analysis/LazyCallGraph.cpp
+++ 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<llvm::LazyCallGraphAnalysis>();
- return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>() ||
- PAC.preservedSet<CFGAnalyses>());
+ return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>());
}
LazyCallGraph &LazyCallGraph::operator=(LazyCallGraph &&G) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111275.377690.patch
Type: text/x-patch
Size: 2046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211006/37e0a269/attachment.bin>
More information about the llvm-commits
mailing list