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
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {

// If we have a single edge PHINode, remove it and replace it with a
// reload from the coroutine frame. (We already took care of multi edge
// PHINodes by rewriting them in the rewritePHIs function).
// PHINodes by normalizing them in the rewritePHIs function).
if (auto *PN = dyn_cast<PHINode>(U)) {
assert(PN->getNumIncomingValues() == 1 &&
"unexpected number of incoming "
Expand Down
12 changes: 11 additions & 1 deletion llvm/lib/Transforms/Coroutines/SuspendCrossingInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,13 @@ SuspendCrossingInfo::SuspendCrossingInfo(
// Mark all CoroEnd Blocks. We do not propagate Kills beyond coro.ends as
// the code beyond coro.end is reachable during initial invocation of the
// coroutine.
for (auto *CE : CoroEnds)
for (auto *CE : CoroEnds) {
// Verify CoroEnd was normalized
assert(CE->getParent()->getFirstInsertionPt() == CE->getIterator() &&
CE->getParent()->size() <= 2 && "CoroEnd must be in its own BB");

getBlockData(CE->getParent()).End = true;
}

// Mark all suspend blocks and indicate that they kill everything they
// consume. Note, that crossing coro.save also requires a spill, as any code
Expand All @@ -179,6 +184,11 @@ SuspendCrossingInfo::SuspendCrossingInfo(
B.Kills |= B.Consumes;
};
for (auto *CSI : CoroSuspends) {
// Verify CoroSuspend was normalized
assert(CSI->getParent()->getFirstInsertionPt() == CSI->getIterator() &&
CSI->getParent()->size() <= 2 &&
"CoroSuspend must be in its own BB");

markSuspendBlock(CSI);
if (auto *Save = CSI->getCoroSave())
markSuspendBlock(Save);
Expand Down