1 ; Test that we can correctly handle vectors of pointers in statepoint
2 ; rewriting. Currently, we scalarize, but that's an implementation detail.
3 ; RUN: opt %s -rewrite-statepoints-for-gc -S | FileCheck %s
5 ; A non-vector relocation for comparison
6 define i64 addrspace(1)* @test(i64 addrspace(1)* %obj) gc "statepoint-example" {
9 ; CHECK-NEXT: gc.relocate
10 ; CHECK-NEXT: ret i64 addrspace(1)* %obj.relocated
12 %safepoint_token = call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @do_safepoint, i32 0, i32 0, i32 0)
13 ret i64 addrspace(1)* %obj
16 ; A base vector from a argument
17 define <2 x i64 addrspace(1)*> @test2(<2 x i64 addrspace(1)*> %obj) gc "statepoint-example" {
19 ; CHECK: extractelement
20 ; CHECK-NEXT: extractelement
21 ; CHECK-NEXT: gc.statepoint
22 ; CHECK-NEXT: gc.relocate
23 ; CHECK-NEXT: gc.relocate
24 ; CHECK-NEXT: insertelement
25 ; CHECK-NEXT: insertelement
26 ; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %5
28 %safepoint_token = call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @do_safepoint, i32 0, i32 0, i32 0)
29 ret <2 x i64 addrspace(1)*> %obj
32 ; A base vector from a load
33 define <2 x i64 addrspace(1)*> @test3(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" {
36 ; CHECK-NEXT: extractelement
37 ; CHECK-NEXT: extractelement
38 ; CHECK-NEXT: gc.statepoint
39 ; CHECK-NEXT: gc.relocate
40 ; CHECK-NEXT: gc.relocate
41 ; CHECK-NEXT: insertelement
42 ; CHECK-NEXT: insertelement
43 ; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %5
45 %obj = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* %ptr
46 %safepoint_token = call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @do_safepoint, i32 0, i32 0, i32 0)
47 ret <2 x i64 addrspace(1)*> %obj
50 declare i32 @fake_personality_function()
52 ; When a statepoint is an invoke rather than a call
53 define <2 x i64 addrspace(1)*> @test4(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" {
56 ; CHECK-NEXT: extractelement
57 ; CHECK-NEXT: extractelement
58 ; CHECK-NEXT: gc.statepoint
60 %obj = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* %ptr
61 invoke i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @do_safepoint, i32 0, i32 0, i32 0)
62 to label %normal_return unwind label %exceptional_return
64 ; CHECK-LABEL: normal_return:
66 ; CHECK-NEXT: gc.relocate
67 ; CHECK-NEXT: insertelement
68 ; CHECK-NEXT: insertelement
69 ; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %6
70 normal_return: ; preds = %entry
71 ret <2 x i64 addrspace(1)*> %obj
73 ; CHECK-LABEL: exceptional_return:
75 ; CHECK-NEXT: gc.relocate
76 ; CHECK-NEXT: insertelement
77 ; CHECK-NEXT: insertelement
78 ; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %10
79 exceptional_return: ; preds = %entry
80 %landing_pad4 = landingpad { i8*, i32 } personality i32 ()* @fake_personality_function
82 ret <2 x i64 addrspace(1)*> %obj
85 declare void @do_safepoint()
87 declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()*, i32, i32, ...)