aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-06-26 12:28:59 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-06-26 12:28:59 +0000
commit135f735af149e305635ba3886065b493d5c2bf8c (patch)
treeefc8ab49d69279615e3d0a3563a7d05354270bf5 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
parentff976c99c79d7a00f1c836a57c3e7499316553c4 (diff)
downloadllvm-135f735af149e305635ba3886065b493d5c2bf8c.zip
llvm-135f735af149e305635ba3886065b493d5c2bf8c.tar.gz
llvm-135f735af149e305635ba3886065b493d5c2bf8c.tar.bz2
Apply clang-tidy's modernize-loop-convert to most of lib/Transforms.
Only minor manual fixes. No functionality change intended. llvm-svn: 273808
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 0b128a1..71980e8 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -685,8 +685,8 @@ static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB,
// Okay, everything after this looks good, check to make sure that this block
// doesn't include any side effects.
- for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- if (I->mayHaveSideEffects())
+ for (Instruction &I : *BB)
+ if (I.mayHaveSideEffects())
return false;
return true;
@@ -736,8 +736,8 @@ static Loop *CloneLoop(Loop *L, Loop *PL, ValueToValueMapTy &VM,
New.addBasicBlockToLoop(cast<BasicBlock>(VM[*I]), *LI);
// Add all of the subloops to the new loop.
- for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
- CloneLoop(*I, &New, VM, LI, LPM);
+ for (Loop *I : *L)
+ CloneLoop(I, &New, VM, LI, LPM);
return &New;
}
@@ -1132,9 +1132,8 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// Rewrite the code to refer to itself.
for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i)
- for (BasicBlock::iterator I = NewBlocks[i]->begin(),
- E = NewBlocks[i]->end(); I != E; ++I)
- RemapInstruction(&*I, VMap,
+ for (Instruction &I : *NewBlocks[i])
+ RemapInstruction(&I, VMap,
RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
// Rewrite the original preheader to select between versions of the loop.
@@ -1237,9 +1236,8 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
Worklist.push_back(UI);
}
- for (std::vector<Instruction*>::iterator UI = Worklist.begin(),
- UE = Worklist.end(); UI != UE; ++UI)
- (*UI)->replaceUsesOfWith(LIC, Replacement);
+ for (Instruction *UI : Worklist)
+ UI->replaceUsesOfWith(LIC, Replacement);
SimplifyCode(Worklist, L);
return;