[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Chris Lattner sabre at nondot.org
Sat Jan 13 17:25:02 PST 2007



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.85 -> 1.86
---
Log message:

Fix PR1101: http://llvm.org/PR1101  and Analysis/ScalarEvolution/trip-count.ll


---
Diffs of the changes:  (+5 -3)

 ScalarEvolution.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.85 llvm/lib/Analysis/ScalarEvolution.cpp:1.86
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.85	Fri Jan 12 12:28:58 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Sat Jan 13 19:24:47 2007
@@ -1506,10 +1506,12 @@
   //
   // Currently we check for this by checking to see if the Exit branch goes to
   // the loop header.  If so, we know it will always execute the same number of
-  // times as the loop.  More extensive analysis could be done to handle more
-  // cases here.
+  // times as the loop.  We also handle the case where the exit block *is* the
+  // loop header.  This is common for un-rotated loops.  More extensive analysis
+  // could be done to handle more cases here.
   if (ExitBr->getSuccessor(0) != L->getHeader() &&
-      ExitBr->getSuccessor(1) != L->getHeader())
+      ExitBr->getSuccessor(1) != L->getHeader() &&
+      ExitBr->getParent() != L->getHeader())
     return UnknownValue;
   
   ICmpInst *ExitCond = dyn_cast<ICmpInst>(ExitBr->getCondition());






More information about the llvm-commits mailing list