1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
4 ; Check that we can handle gc.relocate in a separate block in spill mode.
6 target triple = "x86_64-pc-linux-gnu"
8 declare void @"some_call"(ptr addrspace(1))
9 declare i32 @"personality_function"()
11 define ptr addrspace(1) @test_invoke(ptr addrspace(1) %a, ptr addrspace(1) %b, ptr addrspace(1) %c, ptr addrspace(1) %d, ptr addrspace(1) %e, ptr addrspace(1) %f, ptr addrspace(1) %g, ptr addrspace(1) %h, ptr addrspace(1) %j, ptr addrspace(1) %k, ptr addrspace(1) %l, ptr addrspace(1) %m, ptr addrspace(1) %n, ptr addrspace(1) %o, ptr addrspace(1) %p, ptr addrspace(1) %q, ptr addrspace(1) %r, ptr addrspace(1) %s, ptr addrspace(1) %t)
12 ; CHECK-LABEL: test_invoke:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: pushq %rax
15 ; CHECK-NEXT: .cfi_def_cfa_offset 16
16 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rdi
17 ; CHECK-NEXT: movq %rdi, (%rsp)
19 ; CHECK-NEXT: callq some_call@PLT
22 ; CHECK-NEXT: # %bb.1: # %invoke_safepoint_normal_dest
23 ; CHECK-NEXT: movq (%rsp), %rax
24 ; CHECK-NEXT: popq %rcx
25 ; CHECK-NEXT: .cfi_def_cfa_offset 8
27 ; CHECK-NEXT: .LBB0_2: # %exceptional_return
28 ; CHECK-NEXT: .cfi_def_cfa_offset 16
30 ; CHECK-NEXT: xorl %eax, %eax
31 ; CHECK-NEXT: popq %rcx
32 ; CHECK-NEXT: .cfi_def_cfa_offset 8
34 gc "statepoint-example" personality ptr @"personality_function" {
36 %0 = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %t, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %t)]
37 to label %invoke_safepoint_normal_dest unwind label %exceptional_return
39 invoke_safepoint_normal_dest:
40 %t.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %0, i32 0, i32 0)
41 ret ptr addrspace(1) %t.relocated
44 %landing_pad = landingpad token
46 ret ptr addrspace(1) null
49 define ptr addrspace(1) @test_call(ptr addrspace(1) %a, ptr addrspace(1) %b, ptr addrspace(1) %c, ptr addrspace(1) %d, ptr addrspace(1) %e, ptr addrspace(1) %f, ptr addrspace(1) %g, ptr addrspace(1) %h, ptr addrspace(1) %j, ptr addrspace(1) %k, ptr addrspace(1) %l, ptr addrspace(1) %m, ptr addrspace(1) %n, ptr addrspace(1) %o, ptr addrspace(1) %p, ptr addrspace(1) %q, ptr addrspace(1) %r, ptr addrspace(1) %s, ptr addrspace(1) %t)
50 ; CHECK-LABEL: test_call:
51 ; CHECK: # %bb.0: # %entry
52 ; CHECK-NEXT: pushq %rax
53 ; CHECK-NEXT: .cfi_def_cfa_offset 16
54 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rdi
55 ; CHECK-NEXT: movq %rdi, (%rsp)
56 ; CHECK-NEXT: callq some_call@PLT
58 ; CHECK-NEXT: movq (%rsp), %rax
59 ; CHECK-NEXT: popq %rcx
60 ; CHECK-NEXT: .cfi_def_cfa_offset 8
62 gc "statepoint-example" personality ptr @"personality_function" {
64 %0 = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void (ptr addrspace(1))) @some_call, i32 1, i32 0, ptr addrspace(1) %t, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %t)]
68 %t.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %0, i32 0, i32 0)
69 ret ptr addrspace(1) %t.relocated
71 declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)
72 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32)