[llvm] r255265 - [DeadStoreElimination] Use range-based loops. NFC.
Chad Rosier via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 10 09:27:20 PST 2015
Author: mcrosier
Date: Thu Dec 10 11:27:18 2015
New Revision: 255265
URL: http://llvm.org/viewvc/llvm-project?rev=255265&view=rev
Log:
[DeadStoreElimination] Use range-based loops. NFC.
Modified:
llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp?rev=255265&r1=255264&r2=255265&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/DeadStoreElimination.cpp Thu Dec 10 11:27:18 2015
@@ -678,8 +678,7 @@ bool DSE::runOnBasicBlock(BasicBlock &BB
static void findSafePreds(SmallVectorImpl<BasicBlock *> &PredBlocks,
SmallSetVector<BasicBlock *, 8> &SafeBlocks,
BasicBlock *BB, DominatorTree *DT) {
- for (auto I = pred_begin(BB), E = pred_end(BB); I != E; ++I) {
- BasicBlock *Pred = *I;
+ for (auto *Pred : predecessors(BB)) {
if (Pred == BB)
continue;
// The second check below prevents adding blocks that form a cycle with BB
@@ -689,8 +688,7 @@ static void findSafePreds(SmallVectorImp
continue;
bool PredIsSafe = true;
- for (auto II = succ_begin(Pred), EE = succ_end(Pred); II != EE; ++II) {
- BasicBlock *Succ = *II;
+ for (auto *Succ : successors(Pred)) {
if (Succ == BB || Succ == Pred) // shortcut, BB should be in SafeBlocks
continue;
if (!SafeBlocks.count(Succ)) {
@@ -710,8 +708,7 @@ static bool underlyingObjectsDoNotAlias(
SmallVector<Value *, 4> Pointers;
GetUnderlyingObjects(LI->getPointerOperand(), Pointers, DL);
- for (auto I = Pointers.begin(), E = Pointers.end(); I != E; ++I) {
- Value *BObj = *I;
+ for (auto *BObj : Pointers) {
if (!AA.isNoAlias(AObj, DL.getTypeStoreSize(AObj->getType()), BObj,
DL.getTypeStoreSize(BObj->getType())))
return false;
@@ -858,10 +855,10 @@ bool DSE::MemoryIsNotModifiedBetween(Ins
if (B != FirstBB) {
assert(B != &FirstBB->getParent()->getEntryBlock() &&
"Should not hit the entry block because SI must be dominated by LI");
- for (auto PredI = pred_begin(B), PE = pred_end(B); PredI != PE; ++PredI) {
- if (!Visited.insert(*PredI).second)
+ for (auto *PredI : predecessors(B)) {
+ if (!Visited.insert(PredI).second)
continue;
- WorkList.push_back(*PredI);
+ WorkList.push_back(PredI);
}
}
}
More information about the llvm-commits
mailing list