1 ; RUN: opt -passes=rewrite-statepoints-for-gc,verify -S < %s | FileCheck %s
3 declare ptr addrspace(1) @gc_call()
5 declare ptr @fake_personality_function()
7 define ptr addrspace(1) @test(i1 %c) gc "statepoint-example" personality ptr @fake_personality_function {
10 br i1 %c, label %gc_invoke, label %normal_dest
13 ; CHECK: [[TOKEN:%[^ ]+]] = invoke token {{[^@]+}}@llvm.experimental.gc.statepoint{{[^@]+}}@gc_call
14 %obj = invoke ptr addrspace(1) @gc_call() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
15 to label %normal_dest unwind label %unwind_dest
19 %lpad = landingpad { ptr, i32 }
21 resume { ptr, i32 } undef
23 ; CHECK: [[NORMAL_DEST_SPLIT:[^:]+:]]
24 ; CHECK-NEXT: [[RET_VAL:%[^ ]+]] = call ptr addrspace(1) @llvm.experimental.gc.result.p1(token [[TOKEN]])
25 ; CHECK-NEXT: br label %normal_dest
29 ; CHECK-NEXT: %merge = phi ptr addrspace(1) [ null, %entry ], [ %obj2, %normal_dest1 ]
30 %merge = phi ptr addrspace(1) [ null, %entry ], [ %obj, %gc_invoke ]
31 ret ptr addrspace(1) %merge