summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-12-08 23:52:58 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-12-08 23:52:58 +0000
commit42e551b92d4d688daf88b278074804ab871da711 (patch)
tree6fd5f311128eaac1a7ffc97cf7662fd39101107b
parent0497da4643152b9f717626ed68d1e4bfb4ce8904 (diff)
downloadbcm5719-llvm-42e551b92d4d688daf88b278074804ab871da711.tar.gz
bcm5719-llvm-42e551b92d4d688daf88b278074804ab871da711.zip
[IndVars] Use any_of and foreach instead of explicit for loops; NFC
llvm-svn: 255077
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 308c8f8f7c6..c3db22dba56 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -759,14 +759,9 @@ bool IndVarSimplify::canLoopBeDeleted(
++BI;
}
- for (Loop::block_iterator LI = L->block_begin(), LE = L->block_end();
- LI != LE; ++LI) {
- for (BasicBlock::iterator BI = (*LI)->begin(), BE = (*LI)->end(); BI != BE;
- ++BI) {
- if (BI->mayHaveSideEffects())
- return false;
- }
- }
+ for (auto *BB : L->blocks())
+ if (any_of(*BB, [](Instruction &I) { return I.mayHaveSideEffects(); }))
+ return false;
return true;
}
@@ -1675,10 +1670,10 @@ static bool hasConcreteDefImpl(Value *V, SmallPtrSetImpl<Value*> &Visited,
return false;
// Optimistically handle other instructions.
- for (User::op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI) {
- if (!Visited.insert(*OI).second)
+ for (Value *Op : I->operands()) {
+ if (!Visited.insert(Op).second)
continue;
- if (!hasConcreteDefImpl(*OI, Visited, Depth+1))
+ if (!hasConcreteDefImpl(Op, Visited, Depth+1))
return false;
}
return true;
OpenPOWER on IntegriCloud