Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 2 | |
Philip Reames | 79fa9b7 | 2016-02-22 20:45:56 +0000 | [diff] [blame] | 3 | ; CHECK: derived %obj_to_consume base %obj_to_consume.base |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 4 | |
| 5 | declare void @foo() |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 6 | |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 7 | declare i64 addrspace(1)* @generate_obj() |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 8 | |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 9 | declare void @consume_obj(i64 addrspace(1)*) |
| 10 | |
| 11 | define void @test(i32 %condition) gc "statepoint-example" { |
| 12 | entry: |
| 13 | br label %loop |
| 14 | |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 15 | loop: ; preds = %merge.split, %entry |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 16 | ; CHECK: loop: |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 17 | ; CHECK: [[TOKEN_0:%[^ ]+]] = call token (i64, i32, i64 addrspace(1)* ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64f(i64 2882400000, i32 0, i64 addrspace(1)* ()* @generate_obj, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i3 |
| 18 | ; CHECK-NEXT: [[RESULT_0:%[^ ]+]] = call i64 addrspace(1)* @llvm.experimental.gc.result |
| 19 | %0 = call i64 addrspace(1)* @generate_obj() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ] |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 20 | switch i32 %condition, label %dest_a [ |
| 21 | i32 0, label %dest_b |
| 22 | i32 1, label %dest_c |
| 23 | ] |
| 24 | |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 25 | dest_a: ; preds = %loop |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 26 | br label %merge |
| 27 | |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 28 | dest_b: ; preds = %loop |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 29 | br label %merge |
| 30 | |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 31 | dest_c: ; preds = %loop |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 32 | br label %merge |
| 33 | |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 34 | merge: ; preds = %dest_c, %dest_b, %dest_a |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 35 | ; CHECK: merge: |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 36 | ; CHECK: %obj_to_consume = phi i64 addrspace(1)* [ [[RESULT_0]], %dest_a ], [ null, %dest_b ], [ null, %dest_c ] |
| 37 | %obj_to_consume = phi i64 addrspace(1)* [ %0, %dest_a ], [ null, %dest_b ], [ null, %dest_c ] |
| 38 | call void @consume_obj(i64 addrspace(1)* %obj_to_consume) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ] |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 39 | br label %merge.split |
| 40 | |
| 41 | merge.split: ; preds = %merge |
Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 42 | call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ] |
Philip Reames | a5aeaf4 | 2015-02-28 00:20:48 +0000 | [diff] [blame] | 43 | br label %loop |
| 44 | } |