mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
RegionCloner: Split edges from non cond_br terminators to exit blocks
When we clone the exiting block such edges become critical and we don't like critical non cond_br edges (updating SSA needs to put arguments somewhere and such). radar://20114457 Swift SVN r25982
This commit is contained in:
@@ -1264,6 +1264,16 @@ public:
|
||||
for (auto *BB : OutsideBBs)
|
||||
BBMap[BB] = BB;
|
||||
|
||||
// We need to split any edge from a non cond_br basic block leading to a
|
||||
// exit block. After cloning this edge will become critical if it came from
|
||||
// inside the cloned region. The SSAUpdater can't handle critical non
|
||||
// cond_br edges.
|
||||
for (auto *BB : OutsideBBs)
|
||||
for (auto *Pred : BB->getPreds())
|
||||
if (!isa<CondBranchInst>(Pred->getTerminator()) &&
|
||||
!isa<BranchInst>(Pred->getTerminator()))
|
||||
splitEdgesFromTo(Pred, BB, &DomTree, nullptr);
|
||||
|
||||
// Create the cloned start basic block.
|
||||
auto *ClonedStartBB = new (Mod) SILBasicBlock(CurFun);
|
||||
BBMap[StartBB] = ClonedStartBB;
|
||||
|
||||
Reference in New Issue
Block a user