Skip to content

Commit 223ee10

Browse files
committed
EdgeThreadingCloner. Remove splitCriticalEdges calls.
1 parent 824cf85 commit 223ee10

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

include/swift/SILOptimizer/Utils/BasicBlockOptUtils.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ class SinkAddressProjections {
136136
/// block's branch to jump to the newly cloned block, call cloneBranchTarget
137137
/// instead.
138138
///
139-
/// After cloning, call splitCriticalEdges, then updateSSAAfterCloning. This is
140-
/// decoupled from cloning becaused some clients perform CFG edges updates after
141-
/// cloning but before splitting CFG edges.
139+
/// After cloning, call updateSSAAfterCloning. This is decoupled from cloning
140+
/// becaused some clients perform CFG edges updates after cloning but before
141+
/// splitting CFG edges.
142142
class BasicBlockCloner : public SILCloner<BasicBlockCloner> {
143143
using SuperTy = SILCloner<BasicBlockCloner>;
144144
friend class SILCloner<BasicBlockCloner>;
@@ -225,12 +225,7 @@ class BasicBlockCloner : public SILCloner<BasicBlockCloner> {
225225

226226
bool wasCloned() { return isBlockCloned(origBB); }
227227

228-
/// Call this after processing all instructions to fix the control flow
229-
/// graph. The branch cloner may have left critical edges.
230-
bool splitCriticalEdges(DominanceInfo *domInfo, SILLoopInfo *loopInfo);
231-
232-
/// Helper function to perform SSA updates after calling both
233-
/// cloneBranchTarget and splitCriticalEdges.
228+
/// Helper function to perform SSA updates after calling cloneBranchTarget.
234229
void updateSSAAfterCloning();
235230

236231
protected:

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,6 @@ bool SimplifyCFG::tryJumpThreading(BranchInst *BI) {
11091109
// Duplicate the destination block into this one, rewriting uses of the BBArgs
11101110
// to use the branch arguments as we go.
11111111
Cloner.cloneBranchTarget(BI);
1112-
// Does not currently update DominanceInfo.
1113-
Cloner.splitCriticalEdges(nullptr, nullptr);
11141112
Cloner.updateSSAAfterCloning();
11151113

11161114
// Once all the instructions are copied, we can nuke BI itself. We also add

lib/SILOptimizer/Utils/BasicBlockOptUtils.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,28 +134,6 @@ void BasicBlockCloner::updateSSAAfterCloning() {
134134
}
135135
}
136136

137-
// FIXME: Remove this. SILCloner should not create critical edges.
138-
bool BasicBlockCloner::splitCriticalEdges(DominanceInfo *domInfo,
139-
SILLoopInfo *loopInfo) {
140-
bool changed = false;
141-
// Remove any critical edges that the EdgeThreadingCloner may have
142-
// accidentally created.
143-
for (unsigned succIdx = 0, succEnd = origBB->getSuccessors().size();
144-
succIdx != succEnd; ++succIdx) {
145-
if (nullptr
146-
!= splitCriticalEdge(origBB->getTerminator(), succIdx, domInfo,
147-
loopInfo))
148-
changed |= true;
149-
}
150-
for (unsigned succIdx = 0, succEnd = getNewBB()->getSuccessors().size();
151-
succIdx != succEnd; ++succIdx) {
152-
auto *newBB = splitCriticalEdge(getNewBB()->getTerminator(), succIdx,
153-
domInfo, loopInfo);
154-
changed |= (newBB != nullptr);
155-
}
156-
return changed;
157-
}
158-
159137
void BasicBlockCloner::sinkAddressProjections() {
160138
// Because the address projections chains will be disjoint (an instruction
161139
// in one chain cannot use the result of an instruction in another chain),

0 commit comments

Comments
 (0)