sle.ll 1.1 KB

123456789101112131415161718192021222324252627
  1. ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
  2. ; ScalarEvolution should be able to use nsw information to prove that
  3. ; this loop has a finite trip count.
  4. ; CHECK: @le
  5. ; CHECK: Loop %for.body: backedge-taken count is %n
  6. ; CHECK: Loop %for.body: max backedge-taken count is 9223372036854775807
  7. define void @le(i64 %n, double* nocapture %p) nounwind {
  8. entry:
  9. %cmp6 = icmp slt i64 %n, 0 ; <i1> [#uses=1]
  10. br i1 %cmp6, label %for.end, label %for.body
  11. for.body: ; preds = %for.body, %entry
  12. %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] ; <i64> [#uses=2]
  13. %arrayidx = getelementptr double, double* %p, i64 %i ; <double*> [#uses=2]
  14. %t4 = load double, double* %arrayidx ; <double> [#uses=1]
  15. %mul = fmul double %t4, 2.200000e+00 ; <double> [#uses=1]
  16. store double %mul, double* %arrayidx
  17. %i.next = add nsw i64 %i, 1 ; <i64> [#uses=2]
  18. %cmp = icmp sgt i64 %i.next, %n ; <i1> [#uses=1]
  19. br i1 %cmp, label %for.end, label %for.body
  20. for.end: ; preds = %for.body, %entry
  21. ret void
  22. }