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 4 ; slot used for GC. 5 6 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" 7 target triple = "x86_64-pc-linux-gnu" 8 9 declare zeroext i1 @return_i1() 10 11 ; Can we handle an explicit relocation slot (in the form of an alloca) given 12 ; to the statepoint? 13 define i32 addrspace(1)* @test(i32 addrspace(1)* %ptr) gc "statepoint-example" { 14 ; CHECK-LABEL: test 15 ; CHECK: pushq %rax 16 ; CHECK: movq %rdi, (%rsp) 17 ; CHECK: callq return_i1 18 ; CHECK: movq (%rsp), %rax 19 ; CHECK: popq %rcx 20 ; CHECK: retq 21 entry: 22 %alloca = alloca i32 addrspace(1)*, align 8 23 store i32 addrspace(1)* %ptr, i32 addrspace(1)** %alloca 24 call token (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 27 } 28 29 ; Can we handle an alloca as a deopt value? 30 define i32 addrspace(1)* @test2(i32 addrspace(1)* %ptr) gc "statepoint-example" { 31 ; CHECK-LABEL: test2 32 ; CHECK: pushq %rax 33 ; CHECK: movq %rdi, (%rsp) 34 ; CHECK: callq return_i1 35 ; CHECK: xorl %eax, %eax 36 ; CHECK: popq %rcx 37 ; CHECK: retq 38 entry: 39 %alloca = alloca i32 addrspace(1)*, align 8 40 store i32 addrspace(1)* %ptr, i32 addrspace(1)** %alloca 41 call token (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 43 } 44 45 declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...) 46 47 48 ; CHECK-LABEL: .section .llvm_stackmaps 49 ; CHECK-NEXT: __LLVM_StackMaps: 50 ; Header 51 ; CHECK-NEXT: .byte 1 52 ; CHECK-NEXT: .byte 0 53 ; CHECK-NEXT: .short 0 54 ; Num Functions 55 ; CHECK-NEXT: .long 2 56 ; Num LargeConstants 57 ; CHECK-NEXT: .long 0 58 ; Num Callsites 59 ; CHECK-NEXT: .long 2 60 61 ; Functions and stack size 62 ; CHECK-NEXT: .quad test 63 ; CHECK-NEXT: .quad 8 64 ; CHECK-NEXT: .quad test2 65 ; CHECK-NEXT: .quad 8 66 67 ; Large Constants 68 ; Statepoint ID only 69 ; CHECK: .quad 0 70 71 ; Callsites 72 ; The GC one 73 ; CHECK: .long .Ltmp1-test 74 ; CHECK: .short 0 75 ; CHECK: .short 4 76 ; SmallConstant (0) 77 ; CHECK: .byte 4 78 ; CHECK: .byte 8 79 ; CHECK: .short 0 80 ; CHECK: .long 0 81 ; SmallConstant (0) 82 ; CHECK: .byte 4 83 ; CHECK: .byte 8 84 ; CHECK: .short 0 85 ; CHECK: .long 0 86 ; SmallConstant (0) 87 ; CHECK: .byte 4 88 ; CHECK: .byte 8 89 ; CHECK: .short 0 90 ; CHECK: .long 0 91 ; Direct Spill Slot [RSP+0] 92 ; CHECK: .byte 2 93 ; CHECK: .byte 8 94 ; CHECK: .short 7 95 ; CHECK: .long 0 96 ; No Padding or LiveOuts 97 ; CHECK: .short 0 98 ; CHECK: .short 0 99 ; CHECK: .p2align 3 100 101 ; The Deopt one 102 ; CHECK: .long .Ltmp3-test2 103 ; CHECK: .short 0 104 ; CHECK: .short 4 105 ; SmallConstant (0) 106 ; CHECK: .byte 4 107 ; CHECK: .byte 8 108 ; CHECK: .short 0 109 ; CHECK: .long 0 110 ; SmallConstant (0) 111 ; CHECK: .byte 4 112 ; CHECK: .byte 8 113 ; CHECK: .short 0 114 ; CHECK: .long 0 115 ; SmallConstant (1) 116 ; CHECK: .byte 4 117 ; CHECK: .byte 8 118 ; CHECK: .short 0 119 ; CHECK: .long 1 120 ; Direct Spill Slot [RSP+0] 121 ; CHECK: .byte 2 122 ; CHECK: .byte 8 123 ; CHECK: .short 7 124 ; CHECK: .long 0 125 126 ; No Padding or LiveOuts 127 ; CHECK: .short 0 128 ; CHECK: .short 0 129 ; CHECK: .p2align 3 130 131