1 ; RUN: llc < %s | FileCheck %s
2 ; Check that we can lower a use of an alloca both as a deopt value (where the
3 ; exact meaning is up to the consumer of the stackmap) and as an explicit spill
6 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-pc-linux-gnu"
9 declare zeroext i1 @return_i1()
11 ; Can we handle an explicit relocation slot (in the form of an alloca) given
13 define i32 addrspace(1)* @test(i32 addrspace(1)* %ptr) gc "statepoint-example" {
16 ; CHECK: movq %rdi, (%rsp)
17 ; CHECK: callq return_i1
18 ; CHECK: movq (%rsp), %rax
22 %alloca = alloca i32 addrspace(1)*, align 8
23 store i32 addrspace(1)* %ptr, i32 addrspace(1)** %alloca
24 call i32 (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)** %alloca)
25 %rel = load i32 addrspace(1)*, i32 addrspace(1)** %alloca
26 ret i32 addrspace(1)* %rel
29 ; Can we handle an alloca as a deopt value?
30 define i32 addrspace(1)* @test2(i32 addrspace(1)* %ptr) gc "statepoint-example" {
33 ; CHECK: movq %rdi, (%rsp)
34 ; CHECK: callq return_i1
35 ; CHECK: xorl %eax, %eax
39 %alloca = alloca i32 addrspace(1)*, align 8
40 store i32 addrspace(1)* %ptr, i32 addrspace(1)** %alloca
41 call i32 (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 1, i32 addrspace(1)** %alloca)
42 ret i32 addrspace(1)* null
45 declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
48 ; CHECK-LABEL: .section .llvm_stackmaps
49 ; CHECK-NEXT: __LLVM_StackMaps:
53 ; CHECK-NEXT: .short 0
61 ; Functions and stack size
62 ; CHECK-NEXT: .quad test
64 ; CHECK-NEXT: .quad test2
73 ; CHECK: .long .Ltmp1-test
91 ; Direct Spill Slot [RSP+0]
96 ; No Padding or LiveOuts
102 ; CHECK: .long .Ltmp3-test2
120 ; Direct Spill Slot [RSP+0]
126 ; No Padding or LiveOuts