Skip to content
Open
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
9 changes: 7 additions & 2 deletions lib/Transforms/Utils/SimplifyCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6011,8 +6011,13 @@ static bool serializeTrivialDetachedBlock(BasicBlock *BB) {
// This detached block is empty
// Scan predecessors to verify that all of them detach BB.
for (BasicBlock *PredBB : predecessors(BB)) {
if (!isa<DetachInst>(PredBB->getTerminator()))
return false;
if (auto DI = dyn_cast<DetachInst>(PredBB->getTerminator())) {
// check that we are the detached (and not continuation)
if(DI->getDetached() != BB) return false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For consistent code style, I'd prefer a space between the if and first (.

} else {
// don't serialize if nondetached predecessor
return false;
}
}
// All predecessors detach BB, so we can serialize
for (BasicBlock *PredBB : predecessors(BB)) {
Expand Down