1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -max-registers-for-gc-values=256 -use-registers-for-deopt-values=true -code-model=large -fixup-allow-gcptr-in-csr=true < %s | FileCheck %s
4 ; The test checks that Greedy register allocator should not split single basic block
5 ; if it has only one non-statepoint use. Otherwise we may a redundant register usage.
7 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-pc-win64"
10 define ptr addrspace(1) @foo(ptr addrspace(1) %arg) gc "statepoint-example" {
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: pushq %rbp
14 ; CHECK-NEXT: .cfi_def_cfa_offset 16
15 ; CHECK-NEXT: pushq %r15
16 ; CHECK-NEXT: .cfi_def_cfa_offset 24
17 ; CHECK-NEXT: pushq %r14
18 ; CHECK-NEXT: .cfi_def_cfa_offset 32
19 ; CHECK-NEXT: pushq %r13
20 ; CHECK-NEXT: .cfi_def_cfa_offset 40
21 ; CHECK-NEXT: pushq %r12
22 ; CHECK-NEXT: .cfi_def_cfa_offset 48
23 ; CHECK-NEXT: pushq %rbx
24 ; CHECK-NEXT: .cfi_def_cfa_offset 56
25 ; CHECK-NEXT: pushq %rax
26 ; CHECK-NEXT: .cfi_def_cfa_offset 64
27 ; CHECK-NEXT: .cfi_offset %rbx, -56
28 ; CHECK-NEXT: .cfi_offset %r12, -48
29 ; CHECK-NEXT: .cfi_offset %r13, -40
30 ; CHECK-NEXT: .cfi_offset %r14, -32
31 ; CHECK-NEXT: .cfi_offset %r15, -24
32 ; CHECK-NEXT: .cfi_offset %rbp, -16
33 ; CHECK-NEXT: movq %rdi, (%rsp) # 8-byte Spill
34 ; CHECK-NEXT: movabsq $nocsr, %rax
35 ; CHECK-NEXT: callq *%rax
36 ; CHECK-NEXT: movabsq $bar, %rax
37 ; CHECK-NEXT: movq (%rsp), %rdi # 8-byte Reload
38 ; CHECK-NEXT: callq *%rax # 8-byte Folded Reload
40 ; CHECK-NEXT: movabsq $nocsr, %rax
41 ; CHECK-NEXT: callq *%rax
42 ; CHECK-NEXT: movq (%rsp), %rax # 8-byte Reload
43 ; CHECK-NEXT: addq $8, %rsp
44 ; CHECK-NEXT: .cfi_def_cfa_offset 56
45 ; CHECK-NEXT: popq %rbx
46 ; CHECK-NEXT: .cfi_def_cfa_offset 48
47 ; CHECK-NEXT: popq %r12
48 ; CHECK-NEXT: .cfi_def_cfa_offset 40
49 ; CHECK-NEXT: popq %r13
50 ; CHECK-NEXT: .cfi_def_cfa_offset 32
51 ; CHECK-NEXT: popq %r14
52 ; CHECK-NEXT: .cfi_def_cfa_offset 24
53 ; CHECK-NEXT: popq %r15
54 ; CHECK-NEXT: .cfi_def_cfa_offset 16
55 ; CHECK-NEXT: popq %rbp
56 ; CHECK-NEXT: .cfi_def_cfa_offset 8
59 ; force spill %arg on stack.
64 ; Basic block with two use intructions inside:
65 ; copy to rdi as an argument to call and use in statepoint instruction as gc-live and deopt value.
66 %statepoint_token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void (ptr addrspace(1))) @bar, i32 1, i32 0, ptr addrspace(1) %arg, i32 0, i32 0) [ "deopt"(ptr addrspace(1) %arg), "gc-live"(ptr addrspace(1) %arg) ]
67 %arg.reloc = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %statepoint_token, i32 0, i32 0)
71 ; force spill %arg.reloc on stack.
73 ret ptr addrspace(1) %arg.reloc
76 declare void @nocsr() "no_callee_saved_registers"
77 declare void @bar(ptr addrspace(1))
78 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)
79 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg)