summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index b536b534328..c35478e220b 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -603,12 +603,9 @@ bool IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) {
if (ExitValue->getSCEVType()>=scMulExpr) {
bool HasHardInternalUses = false;
bool HasSoftExternalUses = false;
- unsigned NumUses = 0;
- for (auto IB = Inst->user_begin(), IE = Inst->user_end();
- IB != IE && NumUses <= 6; ++IB) {
- Instruction *UseInstr = cast<Instruction>(*IB);
+ for (auto *IB : Inst->users()) {
+ Instruction *UseInstr = cast<Instruction>(IB);
unsigned Opc = UseInstr->getOpcode();
- NumUses++;
if (L->contains(UseInstr)) {
if (Opc == Instruction::Call)
HasHardInternalUses = true;
@@ -616,11 +613,8 @@ bool IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) {
if (Opc == Instruction::PHI) {
// Do not count the Phi as a use. LCSSA may have inserted
// plenty of trivial ones.
- NumUses--;
- for (auto PB = UseInstr->user_begin(),
- PE = UseInstr->user_end();
- PB != PE && NumUses <= 6; ++PB, ++NumUses) {
- unsigned PhiOpc = cast<Instruction>(*PB)->getOpcode();
+ for (auto *PB : UseInstr->users()) {
+ unsigned PhiOpc = cast<Instruction>(PB)->getOpcode();
if (PhiOpc != Instruction::Call &&
PhiOpc != Instruction::Ret) {
HasSoftExternalUses = true;
@@ -635,7 +629,7 @@ bool IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) {
}
}
}
- if (NumUses <= 6 && HasHardInternalUses && !HasSoftExternalUses)
+ if (HasHardInternalUses && !HasSoftExternalUses)
continue;
}
OpenPOWER on IntegriCloud