157 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -verify-machineinstrs -debug-entry-values < %s | FileCheck %s3; Check that we can lower a use of an alloca both as a deopt value (where the4; exact meaning is up to the consumer of the stackmap) and as an explicit spill5; slot used for GC.6 7target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"8target triple = "x86_64-pc-linux-gnu"9 10declare zeroext i1 @return_i1()11 12; Can we handle an explicit relocation slot (in the form of an alloca) given13; to the statepoint?14define ptr addrspace(1) @test(ptr addrspace(1) %ptr) gc "statepoint-example" {15; CHECK-LABEL: test:16; CHECK: # %bb.0: # %entry17; CHECK-NEXT: pushq %rax18; CHECK-NEXT: .cfi_def_cfa_offset 1619; CHECK-NEXT: movq %rdi, (%rsp)20; CHECK-NEXT: callq return_i1@PLT21; CHECK-NEXT: .Ltmp0:22; CHECK-NEXT: movq (%rsp), %rax23; CHECK-NEXT: popq %rcx24; CHECK-NEXT: .cfi_def_cfa_offset 825; CHECK-NEXT: retq26entry:27 %alloca = alloca ptr addrspace(1), align 828 store ptr addrspace(1) %ptr, ptr %alloca29 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 %alloca31 ret ptr addrspace(1) %rel32}33 34; Can we handle an alloca as a deopt value?35define ptr addrspace(1) @test2(ptr addrspace(1) %ptr) gc "statepoint-example" {36; CHECK-LABEL: test2:37; CHECK: # %bb.0: # %entry38; CHECK-NEXT: pushq %rax39; CHECK-NEXT: .cfi_def_cfa_offset 1640; CHECK-NEXT: movq %rdi, (%rsp)41; CHECK-NEXT: callq return_i1@PLT42; CHECK-NEXT: .Ltmp1:43; CHECK-NEXT: xorl %eax, %eax44; CHECK-NEXT: popq %rcx45; CHECK-NEXT: .cfi_def_cfa_offset 846; CHECK-NEXT: retq47entry:48 %alloca = alloca ptr addrspace(1), align 849 store ptr addrspace(1) %ptr, ptr %alloca50 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) null52}53 54declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)55 56 57; CHECK-LABEL: .section .llvm_stackmaps58; CHECK-NEXT: __LLVM_StackMaps:59; Header60; CHECK-NEXT: .byte 361; CHECK-NEXT: .byte 062; CHECK-NEXT: .short 063; Num Functions64; CHECK-NEXT: .long 265; Num LargeConstants66; CHECK-NEXT: .long 067; Num Callsites68; CHECK-NEXT: .long 269 70; Functions and stack size71; CHECK-NEXT: .quad test72; CHECK-NEXT: .quad 873; CHECK-NEXT: .quad 174; CHECK-NEXT: .quad test275; CHECK-NEXT: .quad 876; CHECK-NEXT: .quad 177 78; Large Constants79; Statepoint ID only80; CHECK: .quad 081 82; Callsites83; The GC one84; CHECK: .long .Ltmp0-test85; CHECK: .short 086; CHECK: .short 487; SmallConstant (0)88; CHECK: .byte 489; CHECK: .byte 090; CHECK: .short 891; CHECK: .short 092; CHECK: .short 093; CHECK: .long 094; SmallConstant (0)95; CHECK: .byte 496; CHECK: .byte 097; CHECK: .short 898; CHECK: .short 099; CHECK: .short 0100; CHECK: .long 0101; SmallConstant (0)102; CHECK: .byte 4103; CHECK: .byte 0104; CHECK: .short 8105; CHECK: .short 0106; CHECK: .short 0107; CHECK: .long 0108; Direct Spill Slot [rsp+0]109; CHECK: .byte 2110; CHECK: .byte 0111; CHECK: .short 8112; CHECK: .short 7113; CHECK: .short 0114; CHECK: .long 0115; No Padding or LiveOuts116; CHECK: .short 0117; CHECK: .short 0118; CHECK: .p2align 3119 120; The Deopt one121; CHECK: .long .Ltmp1-test2122; CHECK: .short 0123; CHECK: .short 4124; SmallConstant (0)125; CHECK: .byte 4126; CHECK: .byte 0127; CHECK: .short 8128; CHECK: .short 0129; CHECK: .short 0130; CHECK: .long 0131; SmallConstant (0)132; CHECK: .byte 4133; CHECK: .byte 0134; CHECK: .short 8135; CHECK: .short 0136; CHECK: .short 0137; CHECK: .long 0138; SmallConstant (1)139; CHECK: .byte 4140; CHECK: .byte 0141; CHECK: .short 8142; CHECK: .short 0143; CHECK: .short 0144; CHECK: .long 1145; Direct Spill Slot [rsp+0]146; CHECK: .byte 2147; CHECK: .byte 0148; CHECK: .short 8149; CHECK: .short 7150; CHECK: .short 0151; CHECK: .long 0152 153; No Padding or LiveOuts154; CHECK: .short 0155; CHECK: .short 0156; CHECK: .p2align 3157