1; Make sure we don't end up in an infinite recursion in singleReachablePHIPath().
2; REQUIRES: asserts
3; RUN: opt -newgvn -S %s | FileCheck %s
4
5@c = external global i64, align 8
6
7; CHECK-LABEL: define void @tinkywinky() {
8; CHECK: entry:
9; CHECK-NEXT:   br i1 undef, label %l2, label %if.then
10; CHECK: if.then:                                          ; preds = %entry
11; CHECK-NEXT:   br label %for.body
12; CHECK: ph:                                               ; preds = %back, %ontrue
13; CHECK-NEXT:   br label %for.body
14; CHECK: for.body:                                         ; preds = %ph, %if.then
15; CHECK-NEXT:   br i1 undef, label %ontrue, label %onfalse
16; CHECK: onfalse:                                          ; preds = %for.body
17; CHECK-NEXT:   %patatino = load i64, i64* @c
18; CHECK-NEXT:   ret void
19; CHECK: ontrue:                                           ; preds = %for.body
20; CHECK-NEXT:   %dipsy = load i64, i64* @c
21; CHECK-NEXT:   br label %ph
22; CHECK: back:                                             ; preds = %l2
23; CHECK-NEXT:   store i8 undef, i8* null
24; CHECK-NEXT:   br label %ph
25; CHECK: end:                                              ; preds = %l2
26; CHECK-NEXT:   ret void
27; CHECK: l2:                                               ; preds = %entry
28; CHECK-NEXT:   br i1 false, label %back, label %end
29; CHECK-NEXT: }
30
31define void @tinkywinky() {
32entry:
33  br i1 undef, label %l2, label %if.then
34if.then:
35  br label %for.body
36ph:
37  br label %for.body
38for.body:
39  br i1 undef, label %ontrue, label %onfalse
40onfalse:
41  %patatino = load i64, i64* @c
42  store i64 %patatino, i64* @c
43  ret void
44ontrue:
45  %dipsy = load i64, i64* @c
46  store i64 %dipsy, i64* @c
47  br label %ph
48back:
49  br label %ph
50end:
51  ret void
52l2:
53  br i1 false, label %back, label %end
54}
55