From 86dae65baa8b4362bc309bd0105a788c567729d8 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 15 Jul 2008 03:40:27 +0000 Subject: [PATCH] Fix up comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53586 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ScalarEvolution.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index d3ff2a5afbb..2f0493aa882 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2675,7 +2675,7 @@ bool ScalarEvolutionsImpl::executesAtLeastOnce(const Loop *L, bool isSigned, return false; } - if (!PreCondLHS->getType()->isInteger()) return false; + if (PreCondLHS->getType()->isInteger()) return false; return LHS == getSCEV(PreCondLHS) && RHS == getSCEV(PreCondRHS); } @@ -2706,12 +2706,14 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L, bool isSigned) { // First, we get the value of the LHS in the first iteration: n SCEVHandle Start = AddRec->getOperand(0); - // Then, we get the value of the LHS in the first iteration in which the - // above condition doesn't hold. This equals to max(m,n). if (executesAtLeastOnce(L, isSigned, - SE.getMinusSCEV(AddRec->getOperand(0), One), RHS)) + SE.getMinusSCEV(AddRec->getOperand(0), One), RHS)) { + // Since we know that the condition is true in order to enter the loop, + // we know that it will run exactly m-n times. return SE.getMinusSCEV(RHS, Start); - else { + } else { + // Then, we get the value of the LHS in the first iteration in which the + // above condition doesn't hold. This equals to max(m,n). SCEVHandle End = isSigned ? SE.getSMaxExpr(RHS, Start) : SE.getUMaxExpr(RHS, Start); -- 2.34.1