1 ;; RUN: opt -passes=rewrite-statepoints-for-gc,verify -S < %s | FileCheck %s
2 ;; This test is to verify that RewriteStatepointsForGC correctly relocates values
3 ;; defined by invoke instruction results.
5 declare ptr addrspace(1) @non_gc_call() "gc-leaf-function"
7 declare void @gc_call()
9 declare ptr @fake_personality_function()
11 define ptr addrspace(1) @test() gc "statepoint-example" personality ptr @fake_personality_function {
15 %obj = invoke ptr addrspace(1) @non_gc_call()
16 to label %normal_dest unwind label %unwind_dest
18 unwind_dest: ; preds = %entry
19 %lpad = landingpad { ptr, i32 }
21 resume { ptr, i32 } undef
23 normal_dest: ; preds = %entry
25 ; CHECK-NEXT: gc.statepoint
26 ; CHECK-NEXT: %obj.relocated = call coldcc ptr addrspace(1)
28 call void @gc_call() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
29 ret ptr addrspace(1) %obj