1
;; RUN: opt %s -place-safepoints -S | FileCheck %s
3
;; This test is to verify that gc_result from a call statepoint
4
;; can have preceding phis in its parent basic block. Unlike
5
;; invoke statepoint, call statepoint does not terminate the
6
;; block, and thus its gc_result is in the same block with the
11
define i32 @test1(i1 %cond, i32 %a) gc "statepoint-example" {
13
br i1 %cond, label %branch1, label %branch2
23
;; CHECK: %phi = phi i32 [ %a, %branch2 ], [ %b, %branch1 ]
24
;; CHECK-NEXT: %safepoint_token.1 = call i32 (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)
25
;; CHECK-NEXT: %ret.2 = call i32 @llvm.experimental.gc.result.i32(i32 %safepoint_token.1)
26
%phi = phi i32 [ %a, %branch2 ], [ %b, %branch1 ]
27
%ret = call i32 @foo()
31
; This function is inlined when inserting a poll.
32
declare void @do_safepoint()
33
define void @gc.safepoint_poll() {
34
; CHECK-LABEL: gc.safepoint_poll
36
call void @do_safepoint()