1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -debug-entry-values < %s | FileCheck %s
3 ; Check that we can lower a use of an alloca both as a deopt value (where the
4 ; exact meaning is up to the consumer of the stackmap) and as an explicit spill
7 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-pc-linux-gnu"
10 declare zeroext i1 @return_i1()
12 ; Can we handle an explicit relocation slot (in the form of an alloca) given
14 define ptr addrspace(1) @test(ptr addrspace(1) %ptr) gc "statepoint-example" {
16 ; CHECK: # %bb.0: # %entry
17 ; CHECK-NEXT: pushq %rax
18 ; CHECK-NEXT: .cfi_def_cfa_offset 16
19 ; CHECK-NEXT: movq %rdi, (%rsp)
20 ; CHECK-NEXT: callq return_i1@PLT
22 ; CHECK-NEXT: movq (%rsp), %rax
23 ; CHECK-NEXT: popq %rcx
24 ; CHECK-NEXT: .cfi_def_cfa_offset 8
27 %alloca = alloca ptr addrspace(1), align 8
28 store ptr addrspace(1) %ptr, ptr %alloca
29 call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live" (ptr %alloca)]
30 %rel = load ptr addrspace(1), ptr %alloca
31 ret ptr addrspace(1) %rel
34 ; Can we handle an alloca as a deopt value?
35 define ptr addrspace(1) @test2(ptr addrspace(1) %ptr) gc "statepoint-example" {
37 ; CHECK: # %bb.0: # %entry
38 ; CHECK-NEXT: pushq %rax
39 ; CHECK-NEXT: .cfi_def_cfa_offset 16
40 ; CHECK-NEXT: movq %rdi, (%rsp)
41 ; CHECK-NEXT: callq return_i1@PLT
43 ; CHECK-NEXT: xorl %eax, %eax
44 ; CHECK-NEXT: popq %rcx
45 ; CHECK-NEXT: .cfi_def_cfa_offset 8
48 %alloca = alloca ptr addrspace(1), align 8
49 store ptr addrspace(1) %ptr, ptr %alloca
50 call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) ["deopt" (ptr %alloca)]
51 ret ptr addrspace(1) null
54 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
57 ; CHECK-LABEL: .section .llvm_stackmaps
58 ; CHECK-NEXT: __LLVM_StackMaps:
62 ; CHECK-NEXT: .short 0
70 ; Functions and stack size
71 ; CHECK-NEXT: .quad test
74 ; CHECK-NEXT: .quad test2
84 ; CHECK: .long .Ltmp0-test
108 ; Direct Spill Slot [rsp+0]
115 ; No Padding or LiveOuts
121 ; CHECK: .long .Ltmp1-test2
145 ; Direct Spill Slot [rsp+0]
153 ; No Padding or LiveOuts