[PATCH] D94258: [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 14:07:09 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a2eaebc09c6: [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94258

Files:
  llvm/lib/Transforms/Coroutines/CoroSplit.cpp
  llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll


Index: llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
===================================================================
--- llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
+++ llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -coro-early -coro-split -S | FileCheck %s
+; RUN: opt < %s -passes='function(coro-early),cgscc(coro-split)' -S | FileCheck %s
 target datalayout = "E-p:64:64"
 
 %swift.type = type { i64 }
Index: llvm/lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -1748,24 +1748,26 @@
     End->eraseFromParent();
   }
 
-  switch (Shape.ABI) {
-  case coro::ABI::Switch:
-    // Each clone in the Switch lowering is independent of the other clones. Let
-    // the LazyCallGraph know about each one separately.
-    for (Function *Clone : Clones)
-      CG.addSplitFunction(N.getFunction(), *Clone);
-    break;
-  case coro::ABI::Async:
-  case coro::ABI::Retcon:
-  case coro::ABI::RetconOnce:
-    // Each clone in the Async/Retcon lowering references of the other clones.
-    // Let the LazyCallGraph know about all of them at once.
-    CG.addSplitRefRecursiveFunctions(N.getFunction(), Clones);
-    break;
-  }
+  if (!Clones.empty()) {
+    switch (Shape.ABI) {
+    case coro::ABI::Switch:
+      // Each clone in the Switch lowering is independent of the other clones.
+      // Let the LazyCallGraph know about each one separately.
+      for (Function *Clone : Clones)
+        CG.addSplitFunction(N.getFunction(), *Clone);
+      break;
+    case coro::ABI::Async:
+    case coro::ABI::Retcon:
+    case coro::ABI::RetconOnce:
+      // Each clone in the Async/Retcon lowering references of the other clones.
+      // Let the LazyCallGraph know about all of them at once.
+      CG.addSplitRefRecursiveFunctions(N.getFunction(), Clones);
+      break;
+    }
 
-  // Let the CGSCC infra handle the changes to the original function.
-  updateCGAndAnalysisManagerForCGSCCPass(CG, C, N, AM, UR, FAM);
+    // Let the CGSCC infra handle the changes to the original function.
+    updateCGAndAnalysisManagerForCGSCCPass(CG, C, N, AM, UR, FAM);
+  }
 
   // Do some cleanup and let the CGSCC infra see if we've cleaned up any edges
   // to the split functions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94258.315241.patch
Type: text/x-patch
Size: 2411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210107/6a9709eb/attachment.bin>


More information about the llvm-commits mailing list