[PATCH] D106306: [NewPM] Bail out of devirtualization wrapper if the current SCC is invalidated

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 19 15:08:15 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6cbb35dd3b2f: [NewPM] Bail out of devirtualization wrapper if the current SCC is invalidated (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106306

Files:
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/test/Other/devirt-invalidated.ll


Index: llvm/test/Other/devirt-invalidated.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/devirt-invalidated.ll
@@ -0,0 +1,30 @@
+; RUN: opt -passes='devirt<0>(inline)' < %s -S | FileCheck %s
+
+; CHECK-NOT: internal
+; CHECK: define void @e()
+; CHECK-NOT: internal
+
+define void @e() {
+entry:
+  call void @b()
+  ret void
+}
+
+define internal void @b() {
+entry:
+  call void @d()
+  call void @c()
+  ret void
+}
+
+define internal void @d() {
+entry:
+  unreachable
+}
+
+define internal void @c() {
+entry:
+  call void @b()
+  call void @e()
+  ret void
+}
Index: llvm/lib/Analysis/CGSCCPassManager.cpp
===================================================================
--- llvm/lib/Analysis/CGSCCPassManager.cpp
+++ llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -432,8 +432,13 @@
       break;
     }
 
-    // Check that we didn't miss any update scenario.
-    assert(!UR.InvalidatedSCCs.count(C) && "Processing an invalid SCC!");
+    // If the CGSCC pass wasn't able to provide a valid updated SCC, the
+    // current SCC may simply need to be skipped if invalid.
+    if (UR.InvalidatedSCCs.count(C)) {
+      LLVM_DEBUG(dbgs() << "Skipping invalidated root or island SCC!\n");
+      break;
+    }
+
     assert(C->begin() != C->end() && "Cannot have an empty SCC!");
 
     // Check whether any of the handles were devirtualized.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106306.359935.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210719/4bf5e6d0/attachment.bin>


More information about the llvm-commits mailing list