1*cee313d2SEric Christopher; RUN: opt < %s -S -rewrite-statepoints-for-gc | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt < %s -S -passes=rewrite-statepoints-for-gc | FileCheck %s
3*cee313d2SEric Christopher
4*cee313d2SEric Christopherdeclare void @foo() "gc-leaf-function"
5*cee313d2SEric Christopherdeclare void @bar()
6*cee313d2SEric Christopher
7*cee313d2SEric Christopher; Calls of functions with the "gc-leaf-function" attribute shouldn't be turned
8*cee313d2SEric Christopher; into a safepoint.  An entry safepoint should get inserted, though.
9*cee313d2SEric Christopherdefine void @test_leaf_function() gc "statepoint-example" {
10*cee313d2SEric Christopher; CHECK-LABEL: test_leaf_function
11*cee313d2SEric Christopher; CHECK-NOT: gc.statepoint
12*cee313d2SEric Christopher; CHECK-NOT: gc.result
13*cee313d2SEric Christopherentry:
14*cee313d2SEric Christopher  call void @foo()
15*cee313d2SEric Christopher  ret void
16*cee313d2SEric Christopher}
17*cee313d2SEric Christopher
18*cee313d2SEric Christopherdefine void @test_leaf_function_call() gc "statepoint-example" {
19*cee313d2SEric Christopher; CHECK-LABEL: test_leaf_function_call
20*cee313d2SEric Christopher; CHECK-NOT: gc.statepoint
21*cee313d2SEric Christopher; CHECK-NOT: gc.result
22*cee313d2SEric Christopherentry:
23*cee313d2SEric Christopher  call void @bar() "gc-leaf-function"
24*cee313d2SEric Christopher  ret void
25*cee313d2SEric Christopher}
26*cee313d2SEric Christopher
27*cee313d2SEric Christopher; This function is inlined when inserting a poll.
28*cee313d2SEric Christopherdeclare void @do_safepoint()
29*cee313d2SEric Christopherdefine void @gc.safepoint_poll() {
30*cee313d2SEric Christopher; CHECK-LABEL: gc.safepoint_poll
31*cee313d2SEric Christopherentry:
32*cee313d2SEric Christopher  call void @do_safepoint()
33*cee313d2SEric Christopher  ret void
34*cee313d2SEric Christopher}
35