1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -newgvn %s -S | FileCheck %s
3
4@b = external global i32, align 4
5@a = external global i32, align 4
6define void @tinkywinky() {
7; CHECK-LABEL: @tinkywinky(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    br label [[L1:%.*]]
10; CHECK:       l1.loopexit:
11; CHECK-NEXT:    br label [[L1]]
12; CHECK:       l1:
13; CHECK-NEXT:    [[F_0:%.*]] = phi i32* [ @b, [[ENTRY:%.*]] ], [ @a, [[L1_LOOPEXIT:%.*]] ]
14; CHECK-NEXT:    br label [[FOR_COND:%.*]]
15; CHECK:       for.cond.loopexit:
16; CHECK-NEXT:    store i8 undef, i8* null
17; CHECK-NEXT:    br label [[FOR_COND]]
18; CHECK:       for.cond:
19; CHECK-NEXT:    br i1 undef, label [[FOR_END14:%.*]], label [[FOR_COND1_PREHEADER:%.*]]
20; CHECK:       for.cond1.preheader:
21; CHECK-NEXT:    br label [[FOR_BODY3:%.*]]
22; CHECK:       for.cond1:
23; CHECK-NEXT:    br label [[L2:%.*]]
24; CHECK:       for.body3:
25; CHECK-NEXT:    br i1 undef, label [[FOR_COND1:%.*]], label [[L1_LOOPEXIT]]
26; CHECK:       l2:
27; CHECK-NEXT:    [[G_4:%.*]] = phi i32* [ @b, [[FOR_END14]] ], [ @a, [[FOR_COND1]] ]
28; CHECK-NEXT:    [[F_2:%.*]] = phi i32* [ [[F_0]], [[FOR_END14]] ], [ @a, [[FOR_COND1]] ]
29; CHECK-NEXT:    br label [[FOR_INC:%.*]]
30; CHECK:       for.inc:
31; CHECK-NEXT:    br i1 false, label [[FOR_COND_LOOPEXIT:%.*]], label [[FOR_INC]]
32; CHECK:       for.end14:
33; CHECK-NEXT:    br label [[L2]]
34;
35entry:
36  br label %l1
37l1.loopexit:
38  %g.223.lcssa = phi i32* [ @b, %for.body3 ]
39  br label %l1
40l1:
41  %g.0 = phi i32* [ undef, %entry ], [ %g.223.lcssa, %l1.loopexit ]
42  %f.0 = phi i32* [ @b, %entry ], [ @a, %l1.loopexit ]
43  br label %for.cond
44for.cond.loopexit:
45  br label %for.cond
46for.cond:
47  %g.1 = phi i32* [ %g.0, %l1 ], [ %g.4, %for.cond.loopexit ]
48  %f.1 = phi i32* [ %f.0, %l1 ], [ %f.2, %for.cond.loopexit ]
49  br i1 undef, label %for.end14, label %for.cond1.preheader
50for.cond1.preheader:
51  br label %for.body3
52for.cond1:
53  br label %l2
54for.body3:
55  br i1 undef, label %for.cond1, label %l1.loopexit
56l2:
57  %g.4 = phi i32* [ %g.1, %for.end14 ], [ @a, %for.cond1 ]
58  %f.2 = phi i32* [ %f.1, %for.end14 ], [ @a, %for.cond1 ]
59  br label %for.inc
60for.inc:
61  br i1 false, label %for.cond.loopexit, label %for.inc
62for.end14:
63  br label %l2
64}
65