[llvm] r342360 - [NFC] Turn unsigned counters into boolean flags
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 16 23:33:30 PDT 2018
Author: mkazantsev
Date: Sun Sep 16 23:33:29 2018
New Revision: 342360
URL: http://llvm.org/viewvc/llvm-project?rev=342360&view=rev
Log:
[NFC] Turn unsigned counters into boolean flags
Modified:
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=342360&r1=342359&r2=342360&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sun Sep 16 23:33:29 2018
@@ -601,8 +601,8 @@ bool IndVarSimplify::rewriteLoopExitValu
// - no use outside of the loop can take advantage of hoisting the
// computation out of the loop
if (ExitValue->getSCEVType()>=scMulExpr) {
- unsigned NumHardInternalUses = 0;
- unsigned NumSoftExternalUses = 0;
+ bool HasHardInternalUses = false;
+ bool HasSoftExternalUses = false;
unsigned NumUses = 0;
for (auto IB = Inst->user_begin(), IE = Inst->user_end();
IB != IE && NumUses <= 6; ++IB) {
@@ -611,7 +611,7 @@ bool IndVarSimplify::rewriteLoopExitValu
NumUses++;
if (L->contains(UseInstr)) {
if (Opc == Instruction::Call)
- NumHardInternalUses++;
+ HasHardInternalUses = true;
} else {
if (Opc == Instruction::PHI) {
// Do not count the Phi as a use. LCSSA may have inserted
@@ -621,16 +621,21 @@ bool IndVarSimplify::rewriteLoopExitValu
PE = UseInstr->user_end();
PB != PE && NumUses <= 6; ++PB, ++NumUses) {
unsigned PhiOpc = cast<Instruction>(*PB)->getOpcode();
- if (PhiOpc != Instruction::Call && PhiOpc != Instruction::Ret)
- NumSoftExternalUses++;
+ if (PhiOpc != Instruction::Call &&
+ PhiOpc != Instruction::Ret) {
+ HasSoftExternalUses = true;
+ break;
+ }
}
continue;
}
- if (Opc != Instruction::Call && Opc != Instruction::Ret)
- NumSoftExternalUses++;
+ if (Opc != Instruction::Call && Opc != Instruction::Ret) {
+ HasSoftExternalUses = true;
+ break;
+ }
}
}
- if (NumUses <= 6 && NumHardInternalUses && !NumSoftExternalUses)
+ if (NumUses <= 6 && HasHardInternalUses && !HasSoftExternalUses)
continue;
}
More information about the llvm-commits
mailing list