1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4 2; RUN: opt -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 < %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 7define void @le(i64 %n, ptr nocapture %p) nounwind { 8; CHECK-LABEL: 'le' 9; CHECK-NEXT: Determining loop execution counts for: @le 10; CHECK-NEXT: Loop %for.body: backedge-taken count is %n 11; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is i64 9223372036854775807 12; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is %n 13; CHECK-NEXT: Loop %for.body: Trip multiple is 1 14; 15entry: 16 %cmp6 = icmp slt i64 %n, 0 ; <i1> [#uses=1] 17 br i1 %cmp6, label %for.end, label %for.body 18 19for.body: ; preds = %for.body, %entry 20 %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] ; <i64> [#uses=2] 21 %arrayidx = getelementptr double, ptr %p, i64 %i ; <ptr> [#uses=2] 22 %t4 = load double, ptr %arrayidx ; <double> [#uses=1] 23 %mul = fmul double %t4, 2.200000e+00 ; <double> [#uses=1] 24 store double %mul, ptr %arrayidx 25 %i.next = add nsw i64 %i, 1 ; <i64> [#uses=2] 26 %cmp = icmp sgt i64 %i.next, %n ; <i1> [#uses=1] 27 br i1 %cmp, label %for.end, label %for.body 28 29for.end: ; preds = %for.body, %entry 30 ret void 31} 32