Skip to content

Commit 38ec08f

Browse files
committed
[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.
1 parent 3200074 commit 38ec08f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+195
-178
lines changed

include/swift/SIL/SILBasicBlock.h

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -211,18 +211,18 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
211211
const_succ_iterator succ_begin() const { return getSuccessors().begin(); }
212212
const_succ_iterator succ_end() const { return getSuccessors().end(); }
213213

214-
SILBasicBlock *getSingleSuccessor() {
214+
SILBasicBlock *getSingleSuccessorBlock() {
215215
if (succ_empty() || std::next(succ_begin()) != succ_end())
216216
return nullptr;
217217
return *succ_begin();
218218
}
219219

220-
const SILBasicBlock *getSingleSuccessor() const {
221-
return const_cast<SILBasicBlock *>(this)->getSingleSuccessor();
220+
const SILBasicBlock *getSingleSuccessorBlock() const {
221+
return const_cast<SILBasicBlock *>(this)->getSingleSuccessorBlock();
222222
}
223223

224224
/// \brief Returns true if \p BB is a successor of this block.
225-
bool isSuccessor(SILBasicBlock *BB) const {
225+
bool isSuccessorBlock(SILBasicBlock *BB) const {
226226
auto Range = getSuccessorBlocks();
227227
return any_of(Range, [&BB](const SILBasicBlock *SuccBB) -> bool {
228228
return BB == SuccBB;
@@ -256,26 +256,30 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
256256
pred_iterator pred_begin() const { return pred_iterator(PredList); }
257257
pred_iterator pred_end() const { return pred_iterator(); }
258258

259-
iterator_range<pred_iterator> getPreds() const {
260-
return {pred_begin(), pred_end() };
259+
iterator_range<pred_iterator> getPredecessorBlocks() const {
260+
return {pred_begin(), pred_end()};
261261
}
262262

263-
bool isPredecessor(SILBasicBlock *BB) const {
264-
return any_of(getPreds(), [&BB](const SILBasicBlock *PredBB) -> bool {
265-
return BB == PredBB;
266-
});
263+
bool isPredecessorBlock(SILBasicBlock *BB) const {
264+
return any_of(
265+
getPredecessorBlocks(),
266+
[&BB](const SILBasicBlock *PredBB) -> bool { return BB == PredBB; });
267267
}
268268

269-
SILBasicBlock *getSinglePredecessor() {
269+
SILBasicBlock *getSinglePredecessorBlock() {
270270
if (pred_empty() || std::next(pred_begin()) != pred_end())
271271
return nullptr;
272272
return *pred_begin();
273273
}
274274

275-
const SILBasicBlock *getSinglePredecessor() const {
276-
return const_cast<SILBasicBlock *>(this)->getSinglePredecessor();
275+
const SILBasicBlock *getSinglePredecessorBlock() const {
276+
return const_cast<SILBasicBlock *>(this)->getSinglePredecessorBlock();
277277
}
278278

279+
//===--------------------------------------------------------------------===//
280+
// Debugging
281+
//===--------------------------------------------------------------------===//
282+
279283
/// Pretty-print the SILBasicBlock.
280284
void dump() const;
281285

include/swift/SILOptimizer/Utils/SCCVisitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class SCCVisitor {
154154
auto *BB = A->getParent();
155155
auto Index = A->getIndex();
156156

157-
for (auto *Pred : BB->getPreds())
157+
for (auto *Pred : BB->getPredecessorBlocks())
158158
getArgsForTerminator(Pred->getTerminator(), BB, Index, Operands);
159159
return;
160160
}

lib/IRGen/IRGenSIL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,7 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
20412041
// Zero the error slot to maintain the invariant that it always
20422042
// contains null. This will frequently become a dead store.
20432043
auto nullError = llvm::Constant::getNullValue(errorValue->getType());
2044-
if (!tryApplyInst->getErrorBB()->getSinglePredecessor()) {
2044+
if (!tryApplyInst->getErrorBB()->getSinglePredecessorBlock()) {
20452045
// Only do that here if we can't move the store to the error block.
20462046
// See below.
20472047
Builder.CreateStore(nullError, errorSlot);
@@ -2059,8 +2059,8 @@ void IRGenSILFunction::visitFullApplySite(FullApplySite site) {
20592059
// Set up the PHI nodes on the error edge.
20602060
assert(errorDest.phis.size() == 1);
20612061
errorDest.phis[0]->addIncoming(errorValue, Builder.GetInsertBlock());
2062-
2063-
if (tryApplyInst->getErrorBB()->getSinglePredecessor()) {
2062+
2063+
if (tryApplyInst->getErrorBB()->getSinglePredecessorBlock()) {
20642064
// Zeroing out the error slot only in the error block increases the chance
20652065
// that it will become a dead store.
20662066
auto origBB = Builder.GetInsertBlock();

lib/SIL/InstructionUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ SILValue swift::stripSinglePredecessorArgs(SILValue V) {
8686

8787
// First try and grab the single predecessor of our parent BB. If we don't
8888
// have one, bail.
89-
SILBasicBlock *Pred = BB->getSinglePredecessor();
89+
SILBasicBlock *Pred = BB->getSinglePredecessorBlock();
9090
if (!Pred)
9191
return V;
9292

lib/SIL/SILArgument.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static SILValue getIncomingValueForPred(const SILBasicBlock *BB,
8686

8787
SILValue SILArgument::getSingleIncomingValue() const {
8888
const SILBasicBlock *Parent = getParent();
89-
const SILBasicBlock *PredBB = Parent->getSinglePredecessor();
89+
const SILBasicBlock *PredBB = Parent->getSinglePredecessorBlock();
9090
if (!PredBB)
9191
return SILValue();
9292
return getIncomingValueForPred(Parent, PredBB, getIndex());
@@ -99,7 +99,7 @@ bool SILArgument::getIncomingValues(llvm::SmallVectorImpl<SILValue> &OutArray) {
9999
return false;
100100

101101
unsigned Index = getIndex();
102-
for (SILBasicBlock *Pred : getParent()->getPreds()) {
102+
for (SILBasicBlock *Pred : getParent()->getPredecessorBlocks()) {
103103
SILValue Value = getIncomingValueForPred(Parent, Pred, Index);
104104
if (!Value)
105105
return false;
@@ -117,7 +117,7 @@ bool SILArgument::getIncomingValues(
117117
return false;
118118

119119
unsigned Index = getIndex();
120-
for (SILBasicBlock *Pred : getParent()->getPreds()) {
120+
for (SILBasicBlock *Pred : getParent()->getPredecessorBlocks()) {
121121
SILValue Value = getIncomingValueForPred(Parent, Pred, Index);
122122
if (!Value)
123123
return false;
@@ -142,7 +142,7 @@ SILValue SILArgument::getIncomingValue(unsigned BBIndex) {
142142
// We use this funky loop since predecessors are stored in a linked list but
143143
// we want array like semantics.
144144
unsigned BBCount = 0;
145-
for (SILBasicBlock *Pred : Parent->getPreds()) {
145+
for (SILBasicBlock *Pred : Parent->getPredecessorBlocks()) {
146146
// If BBCount is not BBIndex, continue.
147147
if (BBCount < BBIndex) {
148148
BBCount++;

lib/SIL/SILPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ class SILPrinter : public SILVisitor<SILPrinter> {
523523
*this << "// Preds:";
524524

525525
llvm::SmallVector<ID, 32> PredIDs;
526-
for (auto *BBI : BB->getPreds())
526+
for (auto *BBI : BB->getPredecessorBlocks())
527527
PredIDs.push_back(getID(BBI));
528528

529529
// Display the pred ids sorted to give a stable use order in the printer's

lib/SIL/SILVerifier.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
33973397
// And its destination block has more than one predecessor.
33983398
SILBasicBlock *DestBB = SrcSuccs[EdgeIdx];
33993399
assert(!DestBB->pred_empty() && "There should be a predecessor");
3400-
if (DestBB->getSinglePredecessor())
3400+
if (DestBB->getSinglePredecessorBlock())
34013401
return false;
34023402

34033403
return true;
@@ -3437,16 +3437,16 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
34373437
// have this basic block in its predecessor/successor list.
34383438
for (const auto *SuccBB : BB->getSuccessorBlocks()) {
34393439
bool FoundSelfInSuccessor = false;
3440-
if (SuccBB->isPredecessor(BB)) {
3440+
if (SuccBB->isPredecessorBlock(BB)) {
34413441
FoundSelfInSuccessor = true;
34423442
break;
34433443
}
34443444
require(FoundSelfInSuccessor, "Must be a predecessor of each successor.");
34453445
}
34463446

3447-
for (const SILBasicBlock *PredBB : BB->getPreds()) {
3447+
for (const SILBasicBlock *PredBB : BB->getPredecessorBlocks()) {
34483448
bool FoundSelfInPredecessor = false;
3449-
if (PredBB->isSuccessor(BB)) {
3449+
if (PredBB->isSuccessorBlock(BB)) {
34503450
FoundSelfInPredecessor = true;
34513451
break;
34523452
}

lib/SILGen/SILGenPattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ void PatternMatchEmission::emitSharedCaseBlocks() {
19891989
// predecessor. We rely on the SIL CFG here, because unemitted shared case
19901990
// blocks might fallthrough into this one.
19911991
if (!hasFallthroughTo && caseBlock->getCaseLabelItems().size() == 1) {
1992-
SILBasicBlock *predBB = caseBB->getSinglePredecessor();
1992+
SILBasicBlock *predBB = caseBB->getSinglePredecessorBlock();
19931993
assert(predBB && "Should only have 1 predecessor because it isn't shared");
19941994
assert(isa<BranchInst>(predBB->getTerminator()) &&
19951995
"Should have uncond branch to shared block");

lib/SILOptimizer/ARC/GlobalARCSequenceDataflow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void ARCSequenceDataflowEvaluator::mergePredecessors(
123123
ARCBBState &BBState = DataHandle.getState();
124124

125125
// For each successor of BB...
126-
for (SILBasicBlock *PredBB : BB->getPreds()) {
126+
for (SILBasicBlock *PredBB : BB->getPredecessorBlocks()) {
127127

128128
// Try to look up the data handle for it. If we don't have any such state,
129129
// then the predecessor must be unreachable from the entrance and thus is
@@ -295,7 +295,7 @@ bool ARCSequenceDataflowEvaluator::processBBBottomUp(
295295
// that this block could not have multiple predecessors since otherwise, the
296296
// edge would be broken.
297297
llvm::TinyPtrVector<SILInstruction *> PredTerminators;
298-
for (SILBasicBlock *PredBB : BB.getPreds()) {
298+
for (SILBasicBlock *PredBB : BB.getPredecessorBlocks()) {
299299
auto *TermInst = PredBB->getTerminator();
300300
if (!isARCSignificantTerminator(TermInst))
301301
continue;

lib/SILOptimizer/Analysis/ARCAnalysis.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@ findMatchingRetains(SILBasicBlock *BB) {
622622
// Did not find a retain in this block, try to go to its predecessors.
623623
if (Kind.first == FindRetainKind::None) {
624624
// We can not find a retain in a block with no predecessors.
625-
if (R.first->getPreds().begin() == R.first->getPreds().end()) {
625+
if (R.first->getPredecessorBlocks().begin() ==
626+
R.first->getPredecessorBlocks().end()) {
626627
EpilogueRetainInsts.clear();
627628
return;
628629
}
@@ -636,7 +637,7 @@ findMatchingRetains(SILBasicBlock *BB) {
636637
if (SA && SA->getParent() != R.first)
637638
SA = nullptr;
638639

639-
for (auto X : R.first->getPreds()) {
640+
for (auto X : R.first->getPredecessorBlocks()) {
640641
if (HandledBBs.find(X) != HandledBBs.end())
641642
continue;
642643
// Try to use the predecessor edge-value.
@@ -875,7 +876,7 @@ static void propagateLiveness(llvm::SmallPtrSetImpl<SILBasicBlock *> &LiveIn,
875876
// First populate a worklist of predecessors.
876877
llvm::SmallVector<SILBasicBlock *, 64> Worklist;
877878
for (auto *BB : LiveIn)
878-
for (auto Pred : BB->getPreds())
879+
for (auto Pred : BB->getPredecessorBlocks())
879880
Worklist.push_back(Pred);
880881

881882
// Now propagate liveness backwards until we hit the alloc_box.
@@ -887,7 +888,7 @@ static void propagateLiveness(llvm::SmallPtrSetImpl<SILBasicBlock *> &LiveIn,
887888
if (BB == DefBB || !LiveIn.insert(BB).second)
888889
continue;
889890

890-
for (auto Pred : BB->getPreds())
891+
for (auto Pred : BB->getPredecessorBlocks())
891892
Worklist.push_back(Pred);
892893
}
893894
}

lib/SILOptimizer/Analysis/EpilogueARCAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void EpilogueARCContext::initializeDataflow() {
4646
SILArgument *A = dyn_cast<SILArgument>(CArg);
4747
if (A && !A->isFunctionArg()) {
4848
// Find predecessor and break the SILArgument to predecessors.
49-
for (auto X : A->getParent()->getPreds()) {
49+
for (auto X : A->getParent()->getPredecessorBlocks()) {
5050
// Try to find the predecessor edge-value.
5151
SILValue IA = A->getIncomingValue(X);
5252
EpilogueARCBlockStates[X]->LocalArg = IA;

lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ static bool linkBBArgs(SILBasicBlock *BB) {
989989
return false;
990990
// We don't need to link to the try_apply's normal result argument, because
991991
// we handle it separately in setAllEscaping() and mergeCalleeGraph().
992-
if (SILBasicBlock *SinglePred = BB->getSinglePredecessor()) {
992+
if (SILBasicBlock *SinglePred = BB->getSinglePredecessorBlock()) {
993993
auto *TAI = dyn_cast<TryApplyInst>(SinglePred->getTerminator());
994994
if (TAI && BB == TAI->getNormalBB())
995995
return false;

lib/SILOptimizer/Analysis/LoopRegionAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void LoopRegionFunctionInfo::verify() {
204204
// If R and OtherR are blocks, then OtherR should be a successor of the
205205
// real block.
206206
if (R->isBlock() && OtherR->isBlock())
207-
assert(R->getBlock()->isSuccessor(OtherR->getBlock()) &&
207+
assert(R->getBlock()->isSuccessorBlock(OtherR->getBlock()) &&
208208
"Expected either R was not a block or OtherR was a CFG level "
209209
"successor of R.");
210210
}
@@ -298,7 +298,7 @@ void LoopRegionFunctionInfo::initializeBlockRegionSuccessors(
298298
void LoopRegionFunctionInfo::markIrreducibleLoopPredecessorsOfNonLoopHeader(
299299
BlockTy *NonHeaderBB, RegionTy *NonHeaderBBRegion,
300300
PostOrderFunctionInfo *PI) {
301-
for (BlockTy *Pred : NonHeaderBB->getPreds()) {
301+
for (BlockTy *Pred : NonHeaderBB->getPredecessorBlocks()) {
302302
// If we do not have an RPO number for a predecessor, it is because the
303303
// predecessor is unreachable and a pass did not clean up after
304304
// itself. Just ignore it, it will be cleaned up by simplify-cfg.

lib/SILOptimizer/Analysis/RCIdentityAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static llvm::Optional<bool> proveNonPayloadedEnumCase(SILBasicBlock *BB,
166166
SILValue RCIdentity) {
167167
// Then see if BB has one predecessor... if it does not, return None so we
168168
// keep searching up the domtree.
169-
SILBasicBlock *SinglePred = BB->getSinglePredecessor();
169+
SILBasicBlock *SinglePred = BB->getSinglePredecessorBlock();
170170
if (!SinglePred)
171171
return None;
172172

lib/SILOptimizer/Analysis/SimplifyInstruction.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ SILValue InstSimplifier::visitEnumInst(EnumInst *EI) {
230230
SILBasicBlock *EnumBlock = EI->getParent();
231231
if (EnumArg->getParent() != EnumBlock)
232232
return SILValue();
233-
234-
auto *Pred = EnumBlock->getSinglePredecessor();
233+
234+
auto *Pred = EnumBlock->getSinglePredecessorBlock();
235235
if (!Pred)
236236
return SILValue();
237237

@@ -257,7 +257,7 @@ SILValue InstSimplifier::visitEnumInst(EnumInst *EI) {
257257
//
258258
// we'll return %0
259259
auto *BB = EI->getParent();
260-
auto *Pred = BB->getSinglePredecessor();
260+
auto *Pred = BB->getSinglePredecessorBlock();
261261
if (!Pred)
262262
return SILValue();
263263

lib/SILOptimizer/IPO/GlobalPropertyOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ void GlobalPropertyOpt::scanInstructions() {
400400
bool hasPreds = false;
401401
SILType Type = BBArg->getType();
402402
if (isArrayType(Type) || isTupleWithArray(Type.getSwiftRValueType())) {
403-
for (auto *Pred : BB.getPreds()) {
403+
for (auto *Pred : BB.getPredecessorBlocks()) {
404404
hasPreds = true;
405405
auto *Term = Pred->getTerminator();
406406
SILValue PredArg;

lib/SILOptimizer/LoopTransforms/ArrayBoundsCheckOpts.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ static bool isRangeChecked(SILValue Start, SILValue End,
668668
return true;
669669

670670
// Look for a branch on EQ around the Preheader.
671-
auto *PreheaderPred = Preheader->getSinglePredecessor();
671+
auto *PreheaderPred = Preheader->getSinglePredecessorBlock();
672672
if (!PreheaderPred)
673673
return false;
674674
auto *CondBr = dyn_cast<CondBranchInst>(PreheaderPred->getTerminator());
@@ -1182,9 +1182,9 @@ static bool hoistBoundsChecks(SILLoop *Loop, DominanceInfo *DT, SILLoopInfo *LI,
11821182
return Changed;
11831183

11841184
// Look back a split edge.
1185-
if (!Loop->isLoopExiting(Latch) && Latch->getSinglePredecessor() &&
1186-
Loop->isLoopExiting(Latch->getSinglePredecessor()))
1187-
Latch = Latch->getSinglePredecessor();
1185+
if (!Loop->isLoopExiting(Latch) && Latch->getSinglePredecessorBlock() &&
1186+
Loop->isLoopExiting(Latch->getSinglePredecessorBlock()))
1187+
Latch = Latch->getSinglePredecessorBlock();
11881188
if (Loop->isLoopExiting(Latch) && Latch->getSuccessors().size() == 2) {
11891189
ExitingBlk = Latch;
11901190
ExitBlk = Loop->contains(Latch->getSuccessors()[0])

lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,7 +1965,7 @@ class RegionCloner : public SILCloner<RegionCloner> {
19651965
// inside the cloned region. The SSAUpdater can't handle critical non
19661966
// cond_br edges.
19671967
for (auto *BB : OutsideBBs) {
1968-
SmallVector<SILBasicBlock*, 8> Preds(BB->getPreds());
1968+
SmallVector<SILBasicBlock *, 8> Preds(BB->getPredecessorBlocks());
19691969
for (auto *Pred : Preds)
19701970
if (!isa<CondBranchInst>(Pred->getTerminator()) &&
19711971
!isa<BranchInst>(Pred->getTerminator()))
@@ -2120,7 +2120,8 @@ class ArrayPropertiesSpecializer {
21202120

21212121
SILLoop *getLoop() {
21222122
auto *LoopInfo = LoopAnalysis->get(HoistableLoopPreheader->getParent());
2123-
return LoopInfo->getLoopFor(HoistableLoopPreheader->getSingleSuccessor());
2123+
return LoopInfo->getLoopFor(
2124+
HoistableLoopPreheader->getSingleSuccessorBlock());
21242125
}
21252126

21262127
protected:
@@ -2234,7 +2235,7 @@ void ArrayPropertiesSpecializer::specializeLoopNest() {
22342235
HoistableLoopPreheader->getTerminator(), DomTree, nullptr);
22352236

22362237
// Get the exit blocks of the original loop.
2237-
auto *Header = CheckBlock->getSingleSuccessor();
2238+
auto *Header = CheckBlock->getSingleSuccessorBlock();
22382239
assert(Header);
22392240

22402241
// Our loop info is not really completely valid anymore since the cloner does

lib/SILOptimizer/LoopTransforms/LoopRotate.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,11 @@ static bool isSingleBlockLoop(SILLoop *L) {
233233
if (BackEdge == Header)
234234
BackEdge = Blocks[0];
235235

236-
if (!BackEdge->getSingleSuccessor())
236+
if (!BackEdge->getSingleSuccessorBlock())
237237
return false;
238238

239-
assert(BackEdge->getSingleSuccessor() == Header && "Loop not well formed");
239+
assert(BackEdge->getSingleSuccessorBlock() == Header &&
240+
"Loop not well formed");
240241

241242
// Check whether the back-edge block is just a split-edge.
242243
return ++BackEdge->begin() == BackEdge->end();
@@ -315,7 +316,7 @@ bool swift::rotateLoop(SILLoop *L, DominanceInfo *DT, SILLoopInfo *LI,
315316
// We don't want to rotate such that we merge two headers of separate loops
316317
// into one. This can be turned into an assert again once we have guaranteed
317318
// preheader insertions.
318-
if (!NewHeader->getSinglePredecessor() && Header != Latch)
319+
if (!NewHeader->getSinglePredecessorBlock() && Header != Latch)
319320
return false;
320321

321322
// Now that we know we can perform the rotation - move the instructions that

0 commit comments

Comments
 (0)