1 ; RUN: opt < %s -scalar-evolution -analyze -enable-new-pm=0 | FileCheck %s
2 ; RUN: opt < %s "-passes=print<scalar-evolution>" -disable-output 2>&1 | FileCheck %s
4 ; One side exit dominating the latch, exact backedge taken count is known.
5 define void @test_01() {
7 ; CHECK-LABEL: Determining loop execution counts for: @test_01
8 ; CHECK-NEXT: Loop %loop: <multiple exits> backedge-taken count is 50
14 %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]
15 %side.cond = icmp slt i32 %iv, 50
16 br i1 %side.cond, label %backedge, label %side.exit
19 %iv.next = add i32 %iv, 1
20 %loop.cond = icmp slt i32 %iv, 100
21 br i1 %loop.cond, label %loop, label %exit
30 define void @test_02(i1 %c) {
32 ; CHECK-LABEL: Determining loop execution counts for: @test_02
33 ; CHECK-NEXT: Loop %loop: <multiple exits> backedge-taken count is 50
39 %iv = phi i32 [ 0, %entry ], [ %iv.next, %backedge ]
40 br i1 %c, label %if.true, label %if.false
49 %side.cond = icmp slt i32 %iv, 50
50 br i1 %side.cond, label %backedge, label %side.exit
53 %iv.next = add i32 %iv, 1
54 %loop.cond = icmp slt i32 %iv, 100
55 br i1 %loop.cond, label %loop, label %exit