Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 1 | ; RUN: opt %s -S -place-safepoints | FileCheck %s |
| 2 | |
| 3 | declare void @foo() "gc-leaf-function" |
Manuel Jacob | 3eedd11 | 2016-01-05 23:59:08 +0000 | [diff] [blame^] | 4 | declare void @bar() |
Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 5 | |
Manuel Jacob | 68b753a | 2016-01-05 19:45:54 +0000 | [diff] [blame] | 6 | ; Calls of functions with the "gc-leaf-function" attribute shouldn't be turned |
| 7 | ; into a safepoint. An entry safepoint should get inserted, though. |
Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 8 | define void @test_leaf_function() gc "statepoint-example" { |
| 9 | ; CHECK-LABEL: test_leaf_function |
| 10 | ; CHECK: gc.statepoint.p0f_isVoidf |
| 11 | ; CHECK-NOT: statepoint |
| 12 | ; CHECK-NOT: gc.result |
| 13 | entry: |
| 14 | call void @foo() |
| 15 | ret void |
| 16 | } |
| 17 | |
Manuel Jacob | 3eedd11 | 2016-01-05 23:59:08 +0000 | [diff] [blame^] | 18 | define void @test_leaf_function_call() gc "statepoint-example" { |
| 19 | ; CHECK-LABEL: test_leaf_function_call |
| 20 | ; CHECK: gc.statepoint.p0f_isVoidf |
| 21 | ; CHECK-NOT: statepoint |
| 22 | ; CHECK-NOT: gc.result |
| 23 | entry: |
| 24 | call void @bar() "gc-leaf-function" |
| 25 | ret void |
| 26 | } |
| 27 | |
Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 28 | ; This function is inlined when inserting a poll. |
| 29 | declare void @do_safepoint() |
| 30 | define void @gc.safepoint_poll() { |
| 31 | ; CHECK-LABEL: gc.safepoint_poll |
| 32 | entry: |
| 33 | call void @do_safepoint() |
| 34 | ret void |
| 35 | } |