1;; RUN: opt -rewrite-statepoints-for-gc -verify -S < %s | FileCheck %s
2
3;; This test is to verify that RewriteStatepointsForGC correctly relocates values
4;; defined by invoke instruction results.
5
6declare i64* addrspace(1)* @non_gc_call()
7
8declare void @gc_call()
9
10declare i32* @fake_personality_function()
11
12; Function Attrs: nounwind
13define i64* addrspace(1)* @test() gc "statepoint-example" {
14entry:
15  %obj = invoke i64* addrspace(1)* @non_gc_call()
16          to label %normal_dest unwind label %unwind_dest
17
18unwind_dest:
19  %lpad = landingpad { i8*, i32 } personality i32* ()* @fake_personality_function
20          cleanup
21  resume { i8*, i32 } undef
22
23normal_dest:
24;; CHECK-LABEL: normal_dest:
25;; CHECK-NEXT: gc.statepoint
26;; CHECK-NEXT: %obj.relocated = call coldcc i64* addrspace(1)*
27  %safepoint_token = call i32 (void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @gc_call, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
28  ret i64* addrspace(1)* %obj
29}
30
31declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()*, i32, i32, ...)
32
33
34