• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -simplifycfg -S | FileCheck %s
2
3define void @test(i32* %P, i32* %Q, i1 %A, i1 %B) {
4; CHECK: test
5; CHECK: br i1
6; CHECK-NOT: br i1
7; CHECK: ret
8; CHECK: ret
9
10entry:
11        br i1 %A, label %a, label %b
12a:
13        br i1 %B, label %b, label %c
14b:
15        store i32 123, i32* %P
16        ret void
17c:
18        ret void
19}
20
21; rdar://10554090
22define zeroext i1 @test2(i64 %i0, i64 %i1) nounwind uwtable readonly ssp {
23entry:
24; CHECK: test2
25; CHECK: br i1
26  %and.i.i = and i64 %i0, 281474976710655
27  %and.i11.i = and i64 %i1, 281474976710655
28  %or.cond = icmp eq i64 %and.i.i, %and.i11.i
29  br i1 %or.cond, label %c, label %a
30
31a:
32; CHECK: br
33  %shr.i4.i = lshr i64 %i0, 48
34  %and.i5.i = and i64 %shr.i4.i, 32767
35  %shr.i.i = lshr i64 %i1, 48
36  %and.i2.i = and i64 %shr.i.i, 32767
37  %cmp9.i = icmp ult i64 %and.i5.i, %and.i2.i
38  br i1 %cmp9.i, label %c, label %b
39
40b:
41; CHECK-NOT: br
42  %shr.i13.i9 = lshr i64 %i1, 48
43  %and.i14.i10 = and i64 %shr.i13.i9, 32767
44  %shr.i.i11 = lshr i64 %i0, 48
45  %and.i11.i12 = and i64 %shr.i.i11, 32767
46  %phitmp = icmp uge i64 %and.i14.i10, %and.i11.i12
47  br label %c
48
49c:
50  %o2 = phi i1 [ false, %a ], [ %phitmp, %b ], [ false, %entry ]
51  ret i1 %o2
52}
53
54; PR13180
55define void @pr13180(i8 %p) {
56entry:
57  %tobool = icmp eq i8 %p, 0
58  br i1 %tobool, label %cond.false, label %cond.true
59
60cond.true:                                        ; preds = %entry
61  br label %cond.end
62
63cond.false:                                       ; preds = %entry
64  %phitmp = icmp eq i8 %p, 0
65  br label %cond.end
66
67cond.end:                                         ; preds = %cond.false, %cond.true
68  %cond = phi i1 [ undef, %cond.true ], [ %phitmp, %cond.false ]
69  unreachable
70}
71