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