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