Sanjoy Das | 0407108 | 2016-01-29 00:28:57 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -S -rewrite-statepoints-for-gc | FileCheck %s |
Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 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 |
Sanjoy Das | f7302c8 | 2016-01-28 21:51:14 +0000 | [diff] [blame] | 10 | ; CHECK-NOT: gc.statepoint |
Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 11 | ; CHECK-NOT: gc.result |
| 12 | entry: |
| 13 | call void @foo() |
| 14 | ret void |
| 15 | } |
| 16 | |
Manuel Jacob | 3eedd11 | 2016-01-05 23:59:08 +0000 | [diff] [blame] | 17 | define void @test_leaf_function_call() gc "statepoint-example" { |
| 18 | ; CHECK-LABEL: test_leaf_function_call |
Sanjoy Das | f7302c8 | 2016-01-28 21:51:14 +0000 | [diff] [blame] | 19 | ; CHECK-NOT: gc.statepoint |
Manuel Jacob | 3eedd11 | 2016-01-05 23:59:08 +0000 | [diff] [blame] | 20 | ; CHECK-NOT: gc.result |
| 21 | entry: |
| 22 | call void @bar() "gc-leaf-function" |
| 23 | ret void |
| 24 | } |
| 25 | |
Manuel Jacob | b8060cd | 2016-01-05 19:40:58 +0000 | [diff] [blame] | 26 | ; This function is inlined when inserting a poll. |
| 27 | declare void @do_safepoint() |
| 28 | define void @gc.safepoint_poll() { |
| 29 | ; CHECK-LABEL: gc.safepoint_poll |
| 30 | entry: |
| 31 | call void @do_safepoint() |
| 32 | ret void |
| 33 | } |