1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[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
This commit is contained in:
Arthur Eubanks 2021-01-07 12:45:23 -08:00
parent cd2a3d948d
commit c36c53588a
2 changed files with 20 additions and 17 deletions

View File

@ -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.

View File

@ -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 }