summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-01-09 17:35:29 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-01-09 17:35:29 +0000
commit530e0db3338c7c83b74f0103f2e24f2ff52b0095 (patch)
tree1abacc8b9406bc902d3d4b8ea669874b1b91666f /llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
parente9e76079745dc2eb9de11badacaa9665a2c39511 (diff)
downloadbcm5719-llvm-530e0db3338c7c83b74f0103f2e24f2ff52b0095.tar.gz
bcm5719-llvm-530e0db3338c7c83b74f0103f2e24f2ff52b0095.zip
[TRE] Simplify code with range-based loops and std::find.
No functional change intended. llvm-svn: 257261
Diffstat (limited to 'llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 0e0b00df85b..4e84d72ae7b 100644
--- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -425,9 +425,7 @@ bool TailCallElim::runTRE(Function &F) {
// with themselves. Check to see if we did and clean up our mess if so. This
// occurs when a function passes an argument straight through to its tail
// call.
- for (unsigned i = 0, e = ArgumentPHIs.size(); i != e; ++i) {
- PHINode *PN = ArgumentPHIs[i];
-
+ for (PHINode *PN : ArgumentPHIs) {
// If the PHI Node is a dynamic constant, replace it with the value it is.
if (Value *PNV = SimplifyInstruction(PN, F.getParent()->getDataLayout())) {
PN->replaceAllUsesWith(PNV);
@@ -468,10 +466,7 @@ bool TailCallElim::CanMoveAboveCall(Instruction *I, CallInst *CI) {
// return value of the call, it must only use things that are defined before
// the call, or movable instructions between the call and the instruction
// itself.
- for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
- if (I->getOperand(i) == CI)
- return false;
- return true;
+ return std::find(I->op_begin(), I->op_end(), CI) == I->op_end();
}
/// Return true if the specified value is the same when the return would exit
OpenPOWER on IntegriCloud