1; Function Attrs: nounwind
2; RUN: llc < %s -march=r600 -mcpu=redwood  | FileCheck %s
3;
4; CFG flattening should use parallel-or to generate branch conditions and
5; then merge if-regions with the same bodies.
6
7; FIXME: For some reason having the allocas here allowed the flatten cfg pass
8; to do its transformation, however now that we are using local memory for
9; allocas, the transformation isn't happening.
10; XFAIL: *
11;
12; CHECK: OR_INT
13; CHECK-NEXT: OR_INT
14; CHECK-NEXT: OR_INT
15define amdgpu_kernel void @_Z9chk1D_512v() #0 {
16entry:
17  %a0 = alloca i32, align 4
18  %b0 = alloca i32, align 4
19  %c0 = alloca i32, align 4
20  %d0 = alloca i32, align 4
21  %a1 = alloca i32, align 4
22  %b1 = alloca i32, align 4
23  %c1 = alloca i32, align 4
24  %d1 = alloca i32, align 4
25  %data = alloca i32, align 4
26  %0 = load i32, i32* %a0, align 4
27  %1 = load i32, i32* %b0, align 4
28  %cmp = icmp ne i32 %0, %1
29  br i1 %cmp, label %land.lhs.true, label %if.else
30
31land.lhs.true:                                    ; preds = %entry
32  %2 = load i32, i32* %c0, align 4
33  %3 = load i32, i32* %d0, align 4
34  %cmp1 = icmp ne i32 %2, %3
35  br i1 %cmp1, label %if.then, label %if.else
36
37if.then:                                          ; preds = %land.lhs.true
38  br label %if.end
39
40if.else:                                          ; preds = %land.lhs.true, %entry
41  store i32 1, i32* %data, align 4
42  br label %if.end
43
44if.end:                                           ; preds = %if.else, %if.then
45  %4 = load i32, i32* %a1, align 4
46  %5 = load i32, i32* %b1, align 4
47  %cmp2 = icmp ne i32 %4, %5
48  br i1 %cmp2, label %land.lhs.true3, label %if.else6
49
50land.lhs.true3:                                   ; preds = %if.end
51  %6 = load i32, i32* %c1, align 4
52  %7 = load i32, i32* %d1, align 4
53  %cmp4 = icmp ne i32 %6, %7
54  br i1 %cmp4, label %if.then5, label %if.else6
55
56if.then5:                                         ; preds = %land.lhs.true3
57  br label %if.end7
58
59if.else6:                                         ; preds = %land.lhs.true3, %if.end
60  store i32 1, i32* %data, align 4
61  br label %if.end7
62
63if.end7:                                          ; preds = %if.else6, %if.then5
64  ret void
65}
66
67