diff options
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 08cca62..2802de6 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -8780,6 +8780,7 @@ ScalarEvolution::computeBackedgeTakenCount(const Loop *L, const SCEV *MustExitMaxBECount = nullptr; const SCEV *MayExitMaxBECount = nullptr; bool MustExitMaxOrZero = false; + bool IsOnlyExit = ExitingBlocks.size() == 1; // Compute the ExitLimit for each loop exit. Use this to populate ExitCounts // and compute maxBECount. @@ -8797,7 +8798,7 @@ ScalarEvolution::computeBackedgeTakenCount(const Loop *L, continue; } - ExitLimit EL = computeExitLimit(L, ExitBB, AllowPredicates); + ExitLimit EL = computeExitLimit(L, ExitBB, IsOnlyExit, AllowPredicates); assert((AllowPredicates || EL.Predicates.empty()) && "Predicated exit limit when predicates are not allowed!"); @@ -8872,7 +8873,7 @@ ScalarEvolution::computeBackedgeTakenCount(const Loop *L, ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimit(const Loop *L, BasicBlock *ExitingBlock, - bool AllowPredicates) { + bool IsOnlyExit, bool AllowPredicates) { assert(L->contains(ExitingBlock) && "Exit count for non-loop block?"); // If our exiting block does not dominate the latch, then its connection with // loop's exit limit may be far from trivial. @@ -8880,7 +8881,6 @@ ScalarEvolution::computeExitLimit(const Loop *L, BasicBlock *ExitingBlock, if (!Latch || !DT.dominates(ExitingBlock, Latch)) return getCouldNotCompute(); - bool IsOnlyExit = (L->getExitingBlock() != nullptr); Instruction *Term = ExitingBlock->getTerminator(); if (BranchInst *BI = dyn_cast<BranchInst>(Term)) { assert(BI->isConditional() && "If unconditional, it can't be in loop!"); @@ -8904,8 +8904,7 @@ ScalarEvolution::computeExitLimit(const Loop *L, BasicBlock *ExitingBlock, } assert(Exit && "Exiting block must have at least one exit"); return computeExitLimitFromSingleExitSwitch( - L, SI, Exit, - /*ControlsOnlyExit=*/IsOnlyExit); + L, SI, Exit, /*ControlsOnlyExit=*/IsOnlyExit); } return getCouldNotCompute(); |