1*e11354c0SNikita Popov; RUN: opt -simple-loop-unswitch -verify-memoryssa -S < %s | FileCheck %s
2cee313d2SEric Christopher
3cee313d2SEric Christopherdefine void @f(i32 %n, i32* %ptr) {
4cee313d2SEric Christopher; CHECK-LABEL: @f(
5cee313d2SEric Christopherentry:
6cee313d2SEric Christopher  br label %loop
7cee313d2SEric Christopher
8cee313d2SEric Christopherloop:
9cee313d2SEric Christopher  %iv = phi i32 [ 0, %entry ], [ %iv.inc, %be ]
10cee313d2SEric Christopher  %iv.inc = add i32 %iv, 1
11cee313d2SEric Christopher  %unswitch_cond_root = icmp ne i32 %iv.inc, 42
12cee313d2SEric Christopher  %us.0 = and i1 %unswitch_cond_root, %unswitch_cond_root
13cee313d2SEric Christopher  %us.1 = and i1 %us.0, %us.0
14cee313d2SEric Christopher  %us.2 = and i1 %us.1, %us.1
15cee313d2SEric Christopher  %us.3 = and i1 %us.2, %us.2
16cee313d2SEric Christopher  %us.4 = and i1 %us.3, %us.3
17cee313d2SEric Christopher  %us.5 = and i1 %us.4, %us.4
18cee313d2SEric Christopher  %us.6 = and i1 %us.5, %us.5
19cee313d2SEric Christopher  %us.7 = and i1 %us.6, %us.6
20cee313d2SEric Christopher  %us.8 = and i1 %us.7, %us.7
21cee313d2SEric Christopher  %us.9 = and i1 %us.8, %us.8
22cee313d2SEric Christopher  %us.10 = and i1 %us.9, %us.9
23cee313d2SEric Christopher  %us.11 = and i1 %us.10, %us.10
24cee313d2SEric Christopher  %us.12 = and i1 %us.11, %us.11
25cee313d2SEric Christopher  %us.13 = and i1 %us.12, %us.12
26cee313d2SEric Christopher  %us.14 = and i1 %us.13, %us.13
27cee313d2SEric Christopher  %us.15 = and i1 %us.14, %us.14
28cee313d2SEric Christopher  %us.16 = and i1 %us.15, %us.15
29cee313d2SEric Christopher  %us.17 = and i1 %us.16, %us.16
30cee313d2SEric Christopher  %us.18 = and i1 %us.17, %us.17
31cee313d2SEric Christopher  %us.19 = and i1 %us.18, %us.18
32cee313d2SEric Christopher  %us.20 = and i1 %us.19, %us.19
33cee313d2SEric Christopher  %us.21 = and i1 %us.20, %us.20
34cee313d2SEric Christopher  %us.22 = and i1 %us.21, %us.21
35cee313d2SEric Christopher  %us.23 = and i1 %us.22, %us.22
36cee313d2SEric Christopher  %us.24 = and i1 %us.23, %us.23
37cee313d2SEric Christopher  %us.25 = and i1 %us.24, %us.24
38cee313d2SEric Christopher  %us.26 = and i1 %us.25, %us.25
39cee313d2SEric Christopher  %us.27 = and i1 %us.26, %us.26
40cee313d2SEric Christopher  %us.28 = and i1 %us.27, %us.27
41cee313d2SEric Christopher  %us.29 = and i1 %us.28, %us.28
42cee313d2SEric Christopher  br i1 %us.29, label %leave, label %be
43cee313d2SEric Christopher
44cee313d2SEric Christopherbe:
45cee313d2SEric Christopher  store volatile i32 0, i32* %ptr
46cee313d2SEric Christopher  %becond = icmp ult i32 %iv.inc, %n
47cee313d2SEric Christopher  br i1 %becond, label %leave, label %loop
48cee313d2SEric Christopher
49cee313d2SEric Christopherleave:
50cee313d2SEric Christopher  ret void
51cee313d2SEric Christopher}
52