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