1; RUN: opt -newgvn -S %s | FileCheck %s
2; REQUIRES: asserts
3
4; CHECK-LABEL: define void @tinkywinky() {
5; CHECK: entry:
6; CHECK-NEXT:   br i1 undef, label %for.cond18, label %for.cond.preheader
7; CHECK: for.cond.preheader:
8; CHECK-NEXT:   br label %for.cond2thread-pre-split
9; CHECK: for.cond2thread-pre-split:
10; CHECK-NEXT:   %conv24 = phi i32 [ 0, %for.cond.preheader ], [ %conv, %for.inc.split ]
11; CHECK-NEXT:   br label %for.inc.split
12; CHECK: for.inc.split:
13; CHECK-NEXT:   %add = shl nsw i32 %conv24, 16
14; CHECK-NEXT:   %sext23 = add i32 %add, 65536
15; CHECK-NEXT:   %conv = ashr exact i32 %sext23, 16
16; CHECK-NEXT:   %cmp = icmp slt i32 %sext23, 3604480
17; CHECK-NEXT:   br i1 %cmp, label %for.cond2thread-pre-split, label %l1.loopexit
18; CHECK: l1.loopexit:
19; CHECK-NEXT:   br label %l1
20; CHECK: l1:
21; CHECK-NEXT:   %0 = load i16, i16* null, align 2
22; CHECK-NEXT:   %g.0.g.0..pr = load i16, i16* null, align 2
23; CHECK-NEXT:   ret void
24; CHECK: for.cond18:
25; CHECK-NEXT:   br label %l1
26; CHECK-NEXT: }
27
28define void @tinkywinky() {
29entry:
30  br i1 undef, label %for.cond18, label %for.cond.preheader
31
32for.cond.preheader:
33  br label %for.cond2thread-pre-split
34
35for.cond2thread-pre-split:
36  %conv24 = phi i32 [ 0, %for.cond.preheader ], [ %conv, %for.inc.split ]
37  br label %for.inc.split
38
39for.inc.split:
40  %add = shl nsw i32 %conv24, 16
41  %sext23 = add i32 %add, 65536
42  %conv = ashr exact i32 %sext23, 16
43  %cmp = icmp slt i32 %sext23, 3604480
44  br i1 %cmp, label %for.cond2thread-pre-split, label %l1.loopexit
45
46l1.loopexit:
47  br label %l1
48
49l1:
50  %h.0 = phi i16* [ undef, %for.cond18 ], [ null, %l1.loopexit ]
51  %0 = load i16, i16* %h.0, align 2
52  store i16 %0, i16* null, align 2
53  %g.0.g.0..pr = load i16, i16* null, align 2
54  %tobool15 = icmp eq i16 %g.0.g.0..pr, 0
55  ret void
56
57for.cond18:
58  br label %l1
59}
60