1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
4 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-pc-linux-gnu"
9 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
10 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32) #3
11 declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32, i32) #3
13 ;; Two gc.relocates of the same input, should require only a single spill/fill
14 define void @test_gcrelocate_uniqueing(i32 addrspace(1)* %ptr) gc "statepoint-example" {
15 ; CHECK-LABEL: test_gcrelocate_uniqueing:
17 ; CHECK-NEXT: subq $24, %rsp
18 ; CHECK-NEXT: .cfi_def_cfa_offset 32
19 ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp)
22 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rdi
23 ; CHECK-NEXT: movq %rdi, %rsi
24 ; CHECK-NEXT: xorl %eax, %eax
25 ; CHECK-NEXT: callq use
26 ; CHECK-NEXT: addq $24, %rsp
27 ; CHECK-NEXT: .cfi_def_cfa_offset 8
29 %tok = tail call token (i64, i32, void ()*, i32, i32, ...)
30 @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @f, i32 0, i32 0, i32 0, i32 2, i32 addrspace(1)* %ptr, i32 undef, i32 addrspace(1)* %ptr, i32 addrspace(1)* %ptr)
31 %a = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 9, i32 9)
32 %b = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 10, i32 10)
33 call void (...) @use(i32 addrspace(1)* %a, i32 addrspace(1)* %b)
37 ;; Two gc.relocates of a bitcasted pointer should only require a single spill/fill
38 define void @test_gcptr_uniqueing(i32 addrspace(1)* %ptr) gc "statepoint-example" {
39 ; CHECK-LABEL: test_gcptr_uniqueing:
41 ; CHECK-NEXT: subq $24, %rsp
42 ; CHECK-NEXT: .cfi_def_cfa_offset 32
43 ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp)
46 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rdi
47 ; CHECK-NEXT: movq %rdi, %rsi
48 ; CHECK-NEXT: xorl %eax, %eax
49 ; CHECK-NEXT: callq use
50 ; CHECK-NEXT: addq $24, %rsp
51 ; CHECK-NEXT: .cfi_def_cfa_offset 8
53 %ptr2 = bitcast i32 addrspace(1)* %ptr to i8 addrspace(1)*
54 %tok = tail call token (i64, i32, void ()*, i32, i32, ...)
55 @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @f, i32 0, i32 0, i32 0, i32 2, i32 addrspace(1)* %ptr, i32 undef, i32 addrspace(1)* %ptr, i8 addrspace(1)* %ptr2)
56 %a = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 9, i32 9)
57 %b = call i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %tok, i32 10, i32 10)
58 call void (...) @use(i32 addrspace(1)* %a, i8 addrspace(1)* %b)
62 ;; A GC value is not dead, and does need to be spill (but not filed) if
63 ;; that same value is also in the deopt list.
64 define void @test_deopt_use(i32 addrspace(1)* %ptr) gc "statepoint-example" {
65 ; CHECK-LABEL: test_deopt_use:
67 ; CHECK-NEXT: subq $24, %rsp
68 ; CHECK-NEXT: .cfi_def_cfa_offset 32
69 ; CHECK-NEXT: movq %rdi, {{[0-9]+}}(%rsp)
72 ; CHECK-NEXT: addq $24, %rsp
73 ; CHECK-NEXT: .cfi_def_cfa_offset 8
75 tail call token (i64, i32, void ()*, i32, i32, ...)
76 @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @f, i32 0, i32 0, i32 0, i32 2, i32 addrspace(1)* %ptr, i32 undef, i32 addrspace(1)* %ptr)
80 ;; A GC value which is truely unused does not need to spilled or filled.
81 define void @test_dse(i32 addrspace(1)* %ptr) gc "statepoint-example" {
82 ; CHECK-LABEL: test_dse:
84 ; CHECK-NEXT: pushq %rax
85 ; CHECK-NEXT: .cfi_def_cfa_offset 16
88 ; CHECK-NEXT: popq %rax
89 ; CHECK-NEXT: .cfi_def_cfa_offset 8
91 tail call token (i64, i32, void ()*, i32, i32, ...)
92 @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @f, i32 0, i32 0, i32 0, i32 2, i32 undef, i32 undef, i32 addrspace(1)* %ptr)