blob: 429f4a3f8544f6c8dd540e991ccba92d260a8e93 [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; RUN: opt < %s -simplifycfg -S | FileCheck %s
2
3define i32 @foo(i32 %x) optforfuzzing {
4entry:
5 %x.addr = alloca i32, align 4
6 store i32 %x, i32* %x.addr, align 4
7 %0 = load i32, i32* %x.addr, align 4
8 %cmp = icmp sgt i32 %0, 16
9 br i1 %cmp, label %land.rhs, label %land.end
10
11land.rhs:
12 %1 = load i32, i32* %x.addr, align 4
13 %cmp1 = icmp slt i32 %1, 32
14 br label %land.end
15
16land.end:
17 %2 = phi i1 [ false, %entry ], [ %cmp1, %land.rhs ]
18 %conv = zext i1 %2 to i32
19 ret i32 %conv
20
21; CHECK-LABEL: define i32 @foo(i32 %x)
22; CHECK: br i1 %cmp, label %land.rhs, label %land.end
23; CHECK-LABEL: land.rhs:
24; CHECK: br label %land.end
25; CHECK-LABEL: land.end:
26; CHECK: phi {{.*}} %entry {{.*}} %land.rhs
27}
28
29define i32 @bar(i32 %x) {
30entry:
31 %x.addr = alloca i32, align 4
32 store i32 %x, i32* %x.addr, align 4
33 %0 = load i32, i32* %x.addr, align 4
34 %cmp = icmp sgt i32 %0, 16
35 br i1 %cmp, label %land.rhs, label %land.end
36
37land.rhs:
38 %1 = load i32, i32* %x.addr, align 4
39 %cmp1 = icmp slt i32 %1, 32
40 br label %land.end
41
42land.end:
43 %2 = phi i1 [ false, %entry ], [ %cmp1, %land.rhs ]
44 %conv = zext i1 %2 to i32
45 ret i32 %conv
46
47; CHECK-LABEL: define i32 @bar(i32 %x)
48; CHECK-NOT: br
49}