1 ;; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s
2 ;; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s
4 ;; This test is to verify that gc_result from a call statepoint
5 ;; can have preceding phis in its parent basic block. Unlike
6 ;; invoke statepoint, call statepoint does not terminate the
7 ;; block, and thus its gc_result is in the same block with the
12 define i32 @test1(i1 %cond, i32 %a) gc "statepoint-example" {
14 br i1 %cond, label %branch1, label %branch2
24 ;; CHECK: %phi = phi i32 [ %a, %branch2 ], [ %b, %branch1 ]
25 ;; CHECK-NEXT: [[TOKEN:%[^ ]+]] = call token (i64, i32, i32 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i32f(i64 2882400000, i32 0, i32 ()* @foo, i32 0, i32 0, i32 0, i32 0
26 ;; CHECK-NEXT: call i32 @llvm.experimental.gc.result.i32(token [[TOKEN]])
27 %phi = phi i32 [ %a, %branch2 ], [ %b, %branch1 ]
28 %ret = call i32 @foo()
32 ; This function is inlined when inserting a poll.
33 declare void @do_safepoint()
34 define void @gc.safepoint_poll() {
35 ; CHECK-LABEL: gc.safepoint_poll
37 call void @do_safepoint()