e1bb5fc5102fc7f305774a40204f4cf73eedbd02
[oota-llvm.git] / test / Transforms / SimplifyCFG / R600 / parallelorifcollapse.ll
1 ; Function Attrs: nounwind
2 ; RUN: opt < %s -mtriple=r600-unknown-linux-gnu -optimizecfg -basicaa -S | FileCheck %s
3 ;
4 ; CFG optimization should use parallel-or mode to generate branch conditions and
5 ; then merge if-regions with the same bodies, which should result in 2 branches.
6 ; To see the assembly output without this transformation, remove -basicaa option.
7 ;
8 ; CHECK: or i1
9 ; CHECK-NEXT: br
10 ; CHECK: br
11 ; CHECK: ret
12 define void @_Z9chk1D_512v() #0 {
13 entry:
14   %a0 = alloca i32, align 4
15   %b0 = alloca i32, align 4
16   %c0 = alloca i32, align 4
17   %d0 = alloca i32, align 4
18   %a1 = alloca i32, align 4
19   %b1 = alloca i32, align 4
20   %c1 = alloca i32, align 4
21   %d1 = alloca i32, align 4
22   %data = alloca i32, align 4
23   %0 = load i32* %a0, align 4
24   %1 = load i32* %b0, align 4
25   %cmp = icmp ne i32 %0, %1
26   br i1 %cmp, label %land.lhs.true, label %if.end
27
28 land.lhs.true:                                    ; preds = %entry
29   %2 = load i32* %c0, align 4
30   %3 = load i32* %d0, align 4
31   %cmp1 = icmp ne i32 %2, %3
32   br i1 %cmp1, label %if.then, label %if.end
33
34 if.then:                                          ; preds = %land.lhs.true
35   store i32 1, i32* %data, align 4
36   br label %if.end
37
38 if.end:                                           ; preds = %if.then, %land.lhs.true, %entry
39   %4 = load i32* %a1, align 4
40   %5 = load i32* %b1, align 4
41   %cmp2 = icmp ne i32 %4, %5
42   br i1 %cmp2, label %land.lhs.true3, label %if.end6
43
44 land.lhs.true3:                                   ; preds = %if.end
45   %6 = load i32* %c1, align 4
46   %7 = load i32* %d1, align 4
47   %cmp4 = icmp ne i32 %6, %7
48   br i1 %cmp4, label %if.then5, label %if.end6
49
50 if.then5:                                         ; preds = %land.lhs.true3
51   store i32 1, i32* %data, align 4
52   br label %if.end6
53
54 if.end6:                                          ; preds = %if.then5, %land.lhs.true3, %if.end
55   ret void
56 }