aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h3
-rw-r--r--lib/Analysis/ScalarEvolution.cpp12
2 files changed, 9 insertions, 6 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index 7404f9c00d..6ef0b35e35 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -449,7 +449,8 @@ namespace llvm {
SCEVHandle getSCEVAtScope(Value *V, const Loop *L);
/// isLoopGuardedByCond - Test whether entry to the loop is protected by
- /// a conditional between LHS and RHS.
+ /// a conditional between LHS and RHS. This is used to help avoid max
+ /// expressions in loop trip counts.
bool isLoopGuardedByCond(const Loop *L, ICmpInst::Predicate Pred,
SCEV *LHS, SCEV *RHS);
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 252eabe2f2..fbfb0308e3 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2986,8 +2986,9 @@ SCEVHandle ScalarEvolution::HowFarToNonZero(SCEV *V, const Loop *L) {
///
BasicBlock *
ScalarEvolution::getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB) {
- // If the block has a unique predecessor, the predecessor must have
- // no other successors from which BB is reachable.
+ // If the block has a unique predecessor, then there is no path from the
+ // predecessor to the block that does not go through the direct edge
+ // from the predecessor to the block.
if (BasicBlock *Pred = BB->getSinglePredecessor())
return Pred;
@@ -3002,10 +3003,11 @@ ScalarEvolution::getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB) {
}
/// isLoopGuardedByCond - Test whether entry to the loop is protected by
-/// a conditional between LHS and RHS.
+/// a conditional between LHS and RHS. This is used to help avoid max
+/// expressions in loop trip counts.
bool ScalarEvolution::isLoopGuardedByCond(const Loop *L,
- ICmpInst::Predicate Pred,
- SCEV *LHS, SCEV *RHS) {
+ ICmpInst::Predicate Pred,
+ SCEV *LHS, SCEV *RHS) {
BasicBlock *Preheader = L->getLoopPreheader();
BasicBlock *PreheaderDest = L->getHeader();