diff options
Diffstat (limited to 'llvm/lib/Analysis/MustExecute.cpp')
| -rw-r--r-- | llvm/lib/Analysis/MustExecute.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp index ad8322d7bd79..ac6590c1d8a2 100644 --- a/llvm/lib/Analysis/MustExecute.cpp +++ b/llvm/lib/Analysis/MustExecute.cpp @@ -81,7 +81,7 @@ void ICFLoopSafetyInfo::computeLoopSafetyInfo(const Loop *CurLoop) { MW.clear(); MayThrow = false; // Figure out the fact that at least one block may throw. - for (auto &BB : CurLoop->blocks()) + for (const auto &BB : CurLoop->blocks()) if (ICF.hasICF(&*BB)) { MayThrow = true; break; @@ -164,7 +164,7 @@ static void collectTransitivePredecessors( if (BB == CurLoop->getHeader()) return; SmallVector<const BasicBlock *, 4> WorkList; - for (auto *Pred : predecessors(BB)) { + for (const auto *Pred : predecessors(BB)) { Predecessors.insert(Pred); WorkList.push_back(Pred); } @@ -180,7 +180,7 @@ static void collectTransitivePredecessors( // @nested and @nested_no_throw in test/Analysis/MustExecute/loop-header.ll. // We can ignore backedge of all loops containing BB to get a sligtly more // optimistic result. - for (auto *PredPred : predecessors(Pred)) + for (const auto *PredPred : predecessors(Pred)) if (Predecessors.insert(PredPred).second) WorkList.push_back(PredPred); } @@ -207,7 +207,7 @@ bool LoopSafetyInfo::allLoopPathsLeadToBlock(const Loop *CurLoop, // 3) Exit blocks which are not taken on 1st iteration. // Memoize blocks we've already checked. SmallPtrSet<const BasicBlock *, 4> CheckedSuccessors; - for (auto *Pred : Predecessors) { + for (const auto *Pred : Predecessors) { // Predecessor block may throw, so it has a side exit. if (blockMayThrow(Pred)) return false; @@ -217,7 +217,7 @@ bool LoopSafetyInfo::allLoopPathsLeadToBlock(const Loop *CurLoop, if (DT->dominates(BB, Pred)) continue; - for (auto *Succ : successors(Pred)) + for (const auto *Succ : successors(Pred)) if (CheckedSuccessors.insert(Succ).second && Succ != BB && !Predecessors.count(Succ)) // By discharging conditions that are not executed on the 1st iteration, @@ -285,7 +285,7 @@ bool ICFLoopSafetyInfo::doesNotWriteMemoryBefore(const BasicBlock *BB, collectTransitivePredecessors(CurLoop, BB, Predecessors); // Find if there any instruction in either predecessor that could write // to memory. - for (auto *Pred : Predecessors) + for (const auto *Pred : Predecessors) if (MW.mayWriteToMemory(Pred)) return false; return true; @@ -413,7 +413,7 @@ class MustExecuteAnnotatedWriter : public AssemblyAnnotationWriter { public: MustExecuteAnnotatedWriter(const Function &F, DominatorTree &DT, LoopInfo &LI) { - for (auto &I: instructions(F)) { + for (const auto &I: instructions(F)) { Loop *L = LI.getLoopFor(I.getParent()); while (L) { if (isMustExecuteIn(I, L, &DT)) { @@ -425,8 +425,8 @@ public: } MustExecuteAnnotatedWriter(const Module &M, DominatorTree &DT, LoopInfo &LI) { - for (auto &F : M) - for (auto &I: instructions(F)) { + for (const auto &F : M) + for (const auto &I: instructions(F)) { Loop *L = LI.getLoopFor(I.getParent()); while (L) { if (isMustExecuteIn(I, L, &DT)) { |
