It's easy to handle SLE/SGE when the loop has a unit stride.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60748 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 2b714de..c9af6de 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2924,8 +2924,12 @@
   if (!R)
     return true;
 
-  if (isSigned)
+  if (isSigned) {
+    if (SC->getValue()->isOne())
+      return R->getValue()->isMaxValue(true);
+
     return true;  // XXX: because we don't have an sdiv scev.
+  }
 
   // If negative, it wraps around every iteration, but we don't care about that.
   APInt S = SC->getValue()->getValue().abs();