Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 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. |
Tom Stellard | 880a80a | 2014-06-17 16:53:14 +0000 | [diff] [blame] | 6 | |
| 7 | ; FIXME: For some reason having the allocas here allowed the flatten cfg pass |
Hiroshi Inoue | 7f46baf | 2017-07-16 08:11:56 +0000 | [diff] [blame] | 8 | ; to do its transformation, however now that we are using local memory for |
Tom Stellard | 880a80a | 2014-06-17 16:53:14 +0000 | [diff] [blame] | 9 | ; allocas, the transformation isn't happening. |
| 10 | ; XFAIL: * |
Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 11 | ; |
| 12 | ; CHECK: OR_INT |
| 13 | ; CHECK-NEXT: OR_INT |
| 14 | ; CHECK-NEXT: OR_INT |
Matt Arsenault | 3dbeefa | 2017-03-21 21:39:51 +0000 | [diff] [blame] | 15 | define amdgpu_kernel void @_Z9chk1D_512v() #0 { |
Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 16 | entry: |
| 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 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 26 | %0 = load i32, i32* %a0, align 4 |
| 27 | %1 = load i32, i32* %b0, align 4 |
Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 28 | %cmp = icmp ne i32 %0, %1 |
| 29 | br i1 %cmp, label %land.lhs.true, label %if.else |
| 30 | |
| 31 | land.lhs.true: ; preds = %entry |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 32 | %2 = load i32, i32* %c0, align 4 |
| 33 | %3 = load i32, i32* %d0, align 4 |
Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 34 | %cmp1 = icmp ne i32 %2, %3 |
| 35 | br i1 %cmp1, label %if.then, label %if.else |
| 36 | |
| 37 | if.then: ; preds = %land.lhs.true |
| 38 | br label %if.end |
| 39 | |
| 40 | if.else: ; preds = %land.lhs.true, %entry |
| 41 | store i32 1, i32* %data, align 4 |
| 42 | br label %if.end |
| 43 | |
| 44 | if.end: ; preds = %if.else, %if.then |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 45 | %4 = load i32, i32* %a1, align 4 |
| 46 | %5 = load i32, i32* %b1, align 4 |
Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 47 | %cmp2 = icmp ne i32 %4, %5 |
| 48 | br i1 %cmp2, label %land.lhs.true3, label %if.else6 |
| 49 | |
| 50 | land.lhs.true3: ; preds = %if.end |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 51 | %6 = load i32, i32* %c1, align 4 |
| 52 | %7 = load i32, i32* %d1, align 4 |
Tom Stellard | aa664d9 | 2013-08-06 02:43:45 +0000 | [diff] [blame] | 53 | %cmp4 = icmp ne i32 %6, %7 |
| 54 | br i1 %cmp4, label %if.then5, label %if.else6 |
| 55 | |
| 56 | if.then5: ; preds = %land.lhs.true3 |
| 57 | br label %if.end7 |
| 58 | |
| 59 | if.else6: ; preds = %land.lhs.true3, %if.end |
| 60 | store i32 1, i32* %data, align 4 |
| 61 | br label %if.end7 |
| 62 | |
| 63 | if.end7: ; preds = %if.else6, %if.then5 |
| 64 | ret void |
| 65 | } |
| 66 | |