[llvm-branch-commits] [llvm] 1a2eaeb - [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones
Arthur Eubanks via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 7 14:10:57 PST 2021
Author: Arthur Eubanks
Date: 2021-01-07T14:06:35-08:00
New Revision: 1a2eaebc09c6a200f93b8beb37130c8b8aab3934
URL: https://github.com/llvm/llvm-project/commit/1a2eaebc09c6a200f93b8beb37130c8b8aab3934
DIFF: https://github.com/llvm/llvm-project/commit/1a2eaebc09c6a200f93b8beb37130c8b8aab3934.diff
LOG: [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones
Apparently there can be no clones, as happens in
coro-retcon-unreachable.ll.
The alternative is to allow no split functions in
addSplitRefRecursiveFunctions(), but it seems better to have the caller
make sure it's not accidentally splitting no functions out.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D94258
Added:
Modified:
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 6fd894d4bcfa..e0bee13d83b4 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -1748,24 +1748,26 @@ static void updateCallGraphAfterCoroutineSplit(
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.
diff --git a/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
index 27ee2fd540a4..4a1c44061b48 100644
--- a/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
+++ b/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 }
More information about the llvm-branch-commits
mailing list