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 6target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128" 7target triple = "x86_64-pc-linux-gnu" 8 9declare zeroext i1 @return_i1() 10 11; Can we handle an explicit relocation slot (in the form of an alloca) given 12; to the statepoint? 13define 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 %rdx 20; CHECK: retq 21entry: 22 %alloca = alloca i32 addrspace(1)*, align 8 23 store i32 addrspace(1)* %ptr, i32 addrspace(1)** %alloca 24 call i32 (i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, 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? 30define 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 %rdx 37; CHECK: retq 38entry: 39 %alloca = alloca i32 addrspace(1)*, align 8 40 store i32 addrspace(1)* %ptr, i32 addrspace(1)** %alloca 41 call i32 (i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 1, i32 addrspace(1)** %alloca) 42 ret i32 addrspace(1)* null 43} 44 45declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(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 2882400000 70 71; Callsites 72; The GC one 73; CHECK: .long .Ltmp1-test 74; CHECK: .short 0 75; CHECK: .short 3 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; Direct Spill Slot [RSP+0] 87; CHECK: .byte 2 88; CHECK: .byte 8 89; CHECK: .short 7 90; CHECK: .long 0 91; No Padding or LiveOuts 92; CHECK: .short 0 93; CHECK: .short 0 94; CHECK: .align 8 95 96; The Deopt one 97; CHECK: .long .Ltmp3-test2 98; CHECK: .short 0 99; CHECK: .short 3 100; SmallConstant (0) 101; CHECK: .byte 4 102; CHECK: .byte 8 103; CHECK: .short 0 104; CHECK: .long 0 105; SmallConstant (1) 106; CHECK: .byte 4 107; CHECK: .byte 8 108; CHECK: .short 0 109; CHECK: .long 1 110; Direct Spill Slot [RSP+0] 111; CHECK: .byte 2 112; CHECK: .byte 8 113; CHECK: .short 7 114; CHECK: .long 0 115 116; No Padding or LiveOuts 117; CHECK: .short 0 118; CHECK: .short 0 119; CHECK: .align 8 120 121 122