forked from OSchip/llvm-project
[Target, Transforms] Use predecessors instead of pred_begin and pred_end (NFC)
This commit is contained in:
parent
4bd46501c3
commit
9800731367
|
@ -2247,8 +2247,7 @@ CleanupAndExit:
|
|||
DT->addNewBlock(MemmoveB, Preheader);
|
||||
// Find the new immediate dominator of the exit block.
|
||||
BasicBlock *ExitD = Preheader;
|
||||
for (auto PI = pred_begin(ExitB), PE = pred_end(ExitB); PI != PE; ++PI) {
|
||||
BasicBlock *PB = *PI;
|
||||
for (BasicBlock *PB : predecessors(ExitB)) {
|
||||
ExitD = DT->findNearestCommonDominator(ExitD, PB);
|
||||
if (!ExitD)
|
||||
break;
|
||||
|
|
|
@ -2610,15 +2610,14 @@ ChangeStatus AAExecutionDomainFunction::updateImpl(Attributor &A) {
|
|||
// Merge all the predecessor states into the current basic block. A basic
|
||||
// block is executed by a single thread if all of its predecessors are.
|
||||
auto MergePredecessorStates = [&](BasicBlock *BB) {
|
||||
if (pred_begin(BB) == pred_end(BB))
|
||||
if (pred_empty(BB))
|
||||
return SingleThreadedBBs.contains(BB);
|
||||
|
||||
bool IsInitialThread = true;
|
||||
for (auto PredBB = pred_begin(BB), PredEndBB = pred_end(BB);
|
||||
PredBB != PredEndBB; ++PredBB) {
|
||||
if (!IsInitialThreadOnly(dyn_cast<BranchInst>((*PredBB)->getTerminator()),
|
||||
for (BasicBlock *PredBB : predecessors(BB)) {
|
||||
if (!IsInitialThreadOnly(dyn_cast<BranchInst>(PredBB->getTerminator()),
|
||||
BB))
|
||||
IsInitialThread &= SingleThreadedBBs.contains(*PredBB);
|
||||
IsInitialThread &= SingleThreadedBBs.contains(PredBB);
|
||||
}
|
||||
|
||||
return IsInitialThread;
|
||||
|
|
|
@ -1578,8 +1578,7 @@ static bool canSplitPredecessors(PHINode *PN, LoopSafetyInfo *SafetyInfo) {
|
|||
// predecessor fairly simple.
|
||||
if (!SafetyInfo->getBlockColors().empty() && BB->getFirstNonPHI()->isEHPad())
|
||||
return false;
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
|
||||
BasicBlock *BBPred = *PI;
|
||||
for (BasicBlock *BBPred : predecessors(BB)) {
|
||||
if (isa<IndirectBrInst>(BBPred->getTerminator()) ||
|
||||
isa<CallBrInst>(BBPred->getTerminator()))
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue