1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -o - %s -fixup-allow-gcptr-in-csr=false -run-pass fixup-statepoint-caller-saved | FileCheck %s
5 ; ModuleID = 'test/CodeGen/X86/statepoint-fixup-invoke.mir'
6 source_filename = "test/CodeGen/X86/statepoint-fixup-invoke.mir"
7 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-pc-linux-gnu"
10 declare void @some_call(ptr addrspace(1))
12 declare i32 @personality_function()
14 define ptr addrspace(1) @test_basic(ptr addrspace(1) %obj, ptr addrspace(1) %obj1) gc "statepoint-example" personality ptr @personality_function {
16 %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) %obj, i32 0, i32 0) [ "gc-live"(ptr addrspace(1) %obj, ptr addrspace(1) %obj1), "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
17 to label %invoke_safepoint_normal_dest unwind label %exceptional_return
19 invoke_safepoint_normal_dest: ; preds = %entry
20 %obj.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %0, i32 0, i32 0) ; (%obj, %obj)
21 %obj1.relocated = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %0, i32 1, i32 1) ; (%obj1, %obj1)
22 br label %normal_return
24 normal_return: ; preds = %invoke_safepoint_normal_dest
25 ret ptr addrspace(1) %obj.relocated
27 exceptional_return: ; preds = %entry
28 %landing_pad = landingpad token
30 %obj.relocated1 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 0, i32 0) ; (%obj, %obj)
31 %obj1.relocated1 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %landing_pad, i32 1, i32 1) ; (%obj1, %obj1)
32 ret ptr addrspace(1) %obj1.relocated1
35 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)
37 ; Function Attrs: nounwind readonly
38 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #0
40 ; Function Attrs: nounwind
41 declare void @llvm.stackprotector(ptr, ptr) #1
43 attributes #0 = { nounwind readonly }
44 attributes #1 = { nounwind }
50 exposesReturnsTwice: false
52 regBankSelected: false
55 tracksRegLiveness: true
59 - { reg: '$rdi', virtual-reg: '' }
60 - { reg: '$rsi', virtual-reg: '' }
62 isFrameAddressTaken: false
63 isReturnAddressTaken: false
72 maxCallFrameSize: 4294967295
73 cvBytesOfCalleeSavedRegisters: 0
74 hasOpaqueSPAdjustment: false
76 hasMustTailInVarArgFunc: false
84 machineFunctionInfo: {}
86 ; CHECK-LABEL: name: test_basic
88 ; CHECK: successors: %bb.1(0x7ffff800), %bb.3(0x00000800)
89 ; CHECK: liveins: $rdi, $rsi
90 ; CHECK-DAG: MOV64mr %stack.0, 1, $noreg, 0, $noreg, $rsi :: (store (s64) into %stack.0)
91 ; CHECK-DAG: MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi :: (store (s64) into %stack.1)
92 ; CHECK: EH_LABEL <mcsymbol .Ltmp0>
93 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
94 ; CHECK: STATEPOINT 0, 0, 1, @some_call, $rdi, 2, 0, 2, 0, 2, 5, 2, 0, 2, -1, 2, 0, 2, 0, 2, 0, 2, 2, 1, 8, %stack.0, 0, 1, 8, %stack.1, 0, 2, 0, 2, 2, 0, 0, 1, 1, csr_64, implicit-def $rsp, implicit-def $ssp :: (load store (s64) on %stack.0), (load store (s64) on %stack.1)
95 ; CHECK-DAG: $r14 = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load (s64) from %stack.0)
96 ; CHECK-DAG: $rbx = MOV64rm %stack.1, 1, $noreg, 0, $noreg :: (load (s64) from %stack.1)
97 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
98 ; CHECK: EH_LABEL <mcsymbol .Ltmp1>
100 ; CHECK: bb.1.invoke_safepoint_normal_dest:
101 ; CHECK: successors: %bb.2(0x80000000)
102 ; CHECK: liveins: $rbx
103 ; CHECK: bb.2.normal_return:
104 ; CHECK: liveins: $rbx
105 ; CHECK: $rax = COPY killed renamable $rbx
107 ; CHECK: bb.3.exceptional_return (landing-pad):
108 ; CHECK: liveins: $rax, $rdx, $r14
109 ; CHECK: EH_LABEL <mcsymbol .Ltmp2>
110 ; CHECK-DAG: $r14 = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load (s64) from %stack.0)
111 ; CHECK-DAG: $rbx = MOV64rm %stack.1, 1, $noreg, 0, $noreg :: (load (s64) from %stack.1)
112 ; CHECK: $rax = COPY killed renamable $r14
115 successors: %bb.1(0x7ffff800), %bb.3(0x00000800)
118 renamable $r14 = COPY $rsi
119 renamable $rbx = COPY $rdi
120 EH_LABEL <mcsymbol .Ltmp0>
121 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
122 renamable $r14, renamable $rbx = STATEPOINT 0, 0, 1, @some_call, $rdi, 2, 0, 2, 0, 2, 5, 2, 0, 2, -1, 2, 0, 2, 0, 2, 0, 2, 2, killed renamable $r14(tied-def 0), killed renamable $rbx(tied-def 1), 2, 0, 2, 2, 0, 0, 1, 1, csr_64, implicit-def $rsp, implicit-def $ssp
123 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
124 EH_LABEL <mcsymbol .Ltmp1>
127 bb.1.invoke_safepoint_normal_dest:
128 successors: %bb.2(0x80000000)
135 $rax = COPY killed renamable $rbx
138 bb.3.exceptional_return (landing-pad):
139 liveins: $rax, $rdx, $r14
141 EH_LABEL <mcsymbol .Ltmp2>
142 $rax = COPY killed renamable $r14