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; CHECK: Printing analysis 'Scalar Evolution Analysis' for function 'f':
5
6; CHECK: Loop %loop: <multiple exits> Unpredictable backedge-taken count.
7; CHECK: Loop %loop: max backedge-taken count is 0
8; CHECK: Loop %loop: Unpredictable predicated backedge-taken count.
9
10
11define void @f(i32 %n, i32* %ptr) {
12entry:
13  br label %loop
14
15loop:
16  %iv = phi i32 [ 0, %entry ], [ %iv.inc, %be ]
17  %iv.inc = add i32 %iv, 1
18  %unswitch_cond_root = icmp ne i32 %iv.inc, 42
19  %us.0 = and i1 %unswitch_cond_root, %unswitch_cond_root
20  %us.1 = and i1 %us.0, %us.0
21  %us.2 = and i1 %us.1, %us.1
22  %us.3 = and i1 %us.2, %us.2
23  %us.4 = and i1 %us.3, %us.3
24  %us.5 = and i1 %us.4, %us.4
25  %us.6 = and i1 %us.5, %us.5
26  %us.7 = and i1 %us.6, %us.6
27  %us.8 = and i1 %us.7, %us.7
28  %us.9 = and i1 %us.8, %us.8
29  %us.10 = and i1 %us.9, %us.9
30  %us.11 = and i1 %us.10, %us.10
31  %us.12 = and i1 %us.11, %us.11
32  %us.13 = and i1 %us.12, %us.12
33  %us.14 = and i1 %us.13, %us.13
34  %us.15 = and i1 %us.14, %us.14
35  %us.16 = and i1 %us.15, %us.15
36  %us.17 = and i1 %us.16, %us.16
37  %us.18 = and i1 %us.17, %us.17
38  %us.19 = and i1 %us.18, %us.18
39  %us.20 = and i1 %us.19, %us.19
40  %us.21 = and i1 %us.20, %us.20
41  %us.22 = and i1 %us.21, %us.21
42  %us.23 = and i1 %us.22, %us.22
43  %us.24 = and i1 %us.23, %us.23
44  %us.25 = and i1 %us.24, %us.24
45  %us.26 = and i1 %us.25, %us.25
46  %us.27 = and i1 %us.26, %us.26
47  %us.28 = and i1 %us.27, %us.27
48  %us.29 = and i1 %us.28, %us.28
49  br i1 %us.29, label %leave, label %be
50
51be:
52  store volatile i32 0, i32* %ptr
53  %becond = icmp ult i32 %iv.inc, %n
54  br i1 %becond, label %leave, label %loop
55
56leave:
57  ret void
58}
59