1 ; RUN: opt -analyze -scalar-evolution %s | FileCheck %s
3 target triple = "x86_64-unknown-linux-gnu"
5 define void @test_and(i16 %in) {
8 bb2: ; preds = %bb1.i, %bb2, %0
9 %_tmp44.i = icmp slt i16 %in, 2
10 br i1 %_tmp44.i, label %bb1.i, label %bb2
12 bb1.i: ; preds = %bb1.i, %bb2
13 %_tmp25.i = phi i16 [ %in, %bb2 ], [ %_tmp6.i, %bb1.i ]
14 %_tmp6.i = add nsw i16 %_tmp25.i, 1
15 %_tmp10.i = icmp sge i16 %_tmp6.i, 2
16 %exitcond.i = icmp eq i16 %_tmp6.i, 2
17 %or.cond = and i1 %_tmp10.i, %exitcond.i
18 br i1 %or.cond, label %bb2, label %bb1.i
21 ; CHECK-LABEL: Determining loop execution counts for: @test_and
22 ; CHECK-NEXT: Loop %bb1.i: backedge-taken count is (1 + (-1 * %in))
23 ; CHECK-NEXT: Loop %bb1.i: max backedge-taken count is -1
24 ; CHECK-NEXT: Loop %bb1.i: Predicated backedge-taken count is (1 + (-1 * %in))
27 define void @test_or() {
28 %C10 = icmp slt i1 undef, undef
29 br i1 %C10, label %BB, label %exit
32 %indvars.iv = phi i64 [ -1, %BB ], [ -1, %0 ]
33 %sum.01 = phi i32 [ %2, %BB ], [ undef, %0 ]
34 %1 = trunc i64 %indvars.iv to i32
35 %2 = add nsw i32 %1, %sum.01
37 %C11 = icmp ult i32 %2, %1
38 %C5 = icmp sle i32 %1, %B3
40 br i1 %B, label %BB, label %exit
42 exit: ; preds = %BB, %0
46 ; CHECK-LABEL: Determining loop execution counts for: @test_or
47 ; CHECK-NEXT: Loop %BB: backedge-taken count is undef
48 ; CHECK-NEXT: Loop %BB: max backedge-taken count is -1
49 ; CHECK-NEXT: Loop %BB: Predicated backedge-taken count is undef