[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:36:47 PDT 2021


aeubanks updated this revision to Diff 377691.
aeubanks added a comment.

-disable-output


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111275/new/

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 -disable-output < %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.377691.patch
Type: text/x-patch
Size: 2062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211006/9ed76811/attachment.bin>


More information about the llvm-commits mailing list