Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,8 @@ static bool willLeaveFunctionImmediatelyAfter(BasicBlock *BB,
if (depth == 0) return false;

// If this is a suspend block, we're about to exit the resumption function.
if (isSuspendBlock(BB)) return true;
if (isSuspendBlock(BB))
return true;
Comment on lines +1757 to +1758
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: generally we don't unrelated changes.


// Recurse into the successors.
for (auto *Succ : successors(BB)) {
Expand Down Expand Up @@ -2288,9 +2289,8 @@ static void doRematerializations(
rewriteMaterializableInstructions(AllRemats);
}

void coro::buildCoroutineFrame(
Function &F, Shape &Shape, TargetTransformInfo &TTI,
const std::function<bool(Instruction &)> &MaterializableCallback) {
void coro::normalizeCoroutine(Function &F, coro::Shape &Shape,
TargetTransformInfo &TTI) {
// Don't eliminate swifterror in async functions that won't be split.
if (Shape.ABI != coro::ABI::Async || !Shape.CoroSuspends.empty())
eliminateSwiftError(F, Shape);
Expand Down Expand Up @@ -2337,10 +2337,12 @@ void coro::buildCoroutineFrame(
// Transforms multi-edge PHI Nodes, so that any value feeding into a PHI will
// never have its definition separated from the PHI by the suspend point.
rewritePHIs(F);
}

// Build suspend crossing info.
void coro::buildCoroutineFrame(
Function &F, Shape &Shape,
const std::function<bool(Instruction &)> &MaterializableCallback) {
SuspendCrossingInfo Checker(F, Shape.CoroSuspends, Shape.CoroEnds);

doRematerializations(F, Checker, MaterializableCallback);

const DominatorTree DT(F);
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/Transforms/Coroutines/CoroInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ struct LLVM_LIBRARY_VISIBILITY Shape {
};

bool defaultMaterializable(Instruction &V);
void normalizeCoroutine(Function &F, coro::Shape &Shape,
TargetTransformInfo &TTI);
void buildCoroutineFrame(
Function &F, Shape &Shape, TargetTransformInfo &TTI,
Function &F, Shape &Shape,
const std::function<bool(Instruction &)> &MaterializableCallback);
CallInst *createMustTailCall(DebugLoc Loc, Function *MustTailCallFn,
TargetTransformInfo &TTI,
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Coroutines/CoroSplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,8 @@ splitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
lowerAwaitSuspends(F, Shape);

simplifySuspendPoints(Shape);
buildCoroutineFrame(F, Shape, TTI, MaterializableCallback);
normalizeCoroutine(F, Shape, TTI);
buildCoroutineFrame(F, Shape, MaterializableCallback);
replaceFrameSizeAndAlignment(Shape);
bool isNoSuspendCoroutine = Shape.CoroSuspends.empty();

Expand Down