From: Max Kazantsev Date: Mon, 17 Sep 2018 06:33:29 +0000 (+0000) Subject: [NFC] Turn unsigned counters into boolean flags X-Git-Tag: llvmorg-8.0.0-rc1~8586 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fe3620261062fabc742708e76fad0be0c54a2a1;p=platform%2Fupstream%2Fllvm.git [NFC] Turn unsigned counters into boolean flags llvm-svn: 342360 --- diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 0c3380a..b536b53 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -601,8 +601,8 @@ bool IndVarSimplify::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) { // - 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::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) { 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::rewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) { PE = UseInstr->user_end(); PB != PE && NumUses <= 6; ++PB, ++NumUses) { unsigned PhiOpc = cast(*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; }