mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[gardening] Standardize SILBasicBlock successor/predecessor methods that deal with blocks rather than the full successor data structure to have the suffix 'Block'.
This was already done for getSuccessorBlocks() to distinguish getting successor blocks from getting the full list of SILSuccessors via getSuccessors(). This commit just makes all of the successor/predecessor code follow that naming convention. Some examples: getSingleSuccessor() => getSingleSuccessorBlock(). isSuccessor() => isSuccessorBlock(). getPreds() => getPredecessorBlocks(). Really, IMO, we should consider renaming SILSuccessor to a more verbose name so that it is clear that it is more of an internal detail of SILBasicBlock's implementation rather than something that one should consider as apart of one's mental model of the IR when one really wants to be thinking about predecessor and successor blocks. But that is not what this commit is trying to change, it is just trying to eliminate a bit of technical debt by making the naming conventions here consistent.
This commit is contained in:
@@ -1965,7 +1965,7 @@ public:
|
||||
// inside the cloned region. The SSAUpdater can't handle critical non
|
||||
// cond_br edges.
|
||||
for (auto *BB : OutsideBBs) {
|
||||
SmallVector<SILBasicBlock*, 8> Preds(BB->getPreds());
|
||||
SmallVector<SILBasicBlock *, 8> Preds(BB->getPredecessorBlocks());
|
||||
for (auto *Pred : Preds)
|
||||
if (!isa<CondBranchInst>(Pred->getTerminator()) &&
|
||||
!isa<BranchInst>(Pred->getTerminator()))
|
||||
@@ -2120,7 +2120,8 @@ public:
|
||||
|
||||
SILLoop *getLoop() {
|
||||
auto *LoopInfo = LoopAnalysis->get(HoistableLoopPreheader->getParent());
|
||||
return LoopInfo->getLoopFor(HoistableLoopPreheader->getSingleSuccessor());
|
||||
return LoopInfo->getLoopFor(
|
||||
HoistableLoopPreheader->getSingleSuccessorBlock());
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -2234,7 +2235,7 @@ void ArrayPropertiesSpecializer::specializeLoopNest() {
|
||||
HoistableLoopPreheader->getTerminator(), DomTree, nullptr);
|
||||
|
||||
// Get the exit blocks of the original loop.
|
||||
auto *Header = CheckBlock->getSingleSuccessor();
|
||||
auto *Header = CheckBlock->getSingleSuccessorBlock();
|
||||
assert(Header);
|
||||
|
||||
// Our loop info is not really completely valid anymore since the cloner does
|
||||
|
||||
Reference in New Issue
Block a user