1 ; RUN: opt -rewrite-statepoints-for-gc -verify -S < %s | FileCheck %s 2 3 declare i8 addrspace(1)* @gc_call() 4 5 declare i32* @fake_personality_function() 6 7 define i8 addrspace(1)* @test(i1 %c) gc "statepoint-example" personality i32* ()* @fake_personality_function { 8 ; CHECK-LABEL: @test( 9 entry: 10 br i1 %c, label %gc_invoke, label %normal_dest 11 12 gc_invoke: 13 ; CHECK: [[TOKEN:%[^ ]+]] = invoke token {{[^@]+}}@llvm.experimental.gc.statepoint{{[^@]+}}@gc_call 14 %obj = invoke i8 addrspace(1)* @gc_call() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ] 15 to label %normal_dest unwind label %unwind_dest 16 17 unwind_dest: 18 ; CHECK: unwind_dest: 19 %lpad = landingpad { i8*, i32 } 20 cleanup 21 resume { i8*, i32 } undef 22 23 ; CHECK: [[NORMAL_DEST_SPLIT:[^:]+:]] 24 ; CHECK-NEXT: [[RET_VAL:%[^ ]+]] = call i8 addrspace(1)* @llvm.experimental.gc.result.p1i8(token [[TOKEN]]) 25 ; CHECK-NEXT: br label %normal_dest 26 27 normal_dest: 28 ; CHECK: normal_dest: 29 ; CHECK-NEXT: %merge = phi i8 addrspace(1)* [ null, %entry ], [ %obj2, %normal_dest1 ] 30 %merge = phi i8 addrspace(1)* [ null, %entry ], [ %obj, %gc_invoke ] 31 ret i8 addrspace(1)* %merge 32 } 33