• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3
4--- |
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"
9
10  declare void @some_call(i64 addrspace(1)*)
11
12  declare i32 @personality_function()
13
14  define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality_function {
15  entry:
16    %0 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0) [ "gc-live"(i64 addrspace(1)* %obj, i64 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
18
19  invoke_safepoint_normal_dest:                     ; preds = %entry
20    %obj.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 0, i32 0) ; (%obj, %obj)
21    %obj1.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 1, i32 1) ; (%obj1, %obj1)
22    br label %normal_return
23
24  normal_return:                                    ; preds = %invoke_safepoint_normal_dest
25    ret i64 addrspace(1)* %obj.relocated
26
27  exceptional_return:                               ; preds = %entry
28    %landing_pad = landingpad token
29            cleanup
30    %obj.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 0, i32 0) ; (%obj, %obj)
31    %obj1.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 1, i32 1) ; (%obj1, %obj1)
32    ret i64 addrspace(1)* %obj1.relocated1
33  }
34
35  declare token @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 immarg, i32 immarg, void (i64 addrspace(1)*)*, i32 immarg, i32 immarg, ...)
36
37  ; Function Attrs: nounwind readonly
38  declare i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token, i32 immarg, i32 immarg) #0
39
40  ; Function Attrs: nounwind
41  declare void @llvm.stackprotector(i8*, i8**) #1
42
43  attributes #0 = { nounwind readonly }
44  attributes #1 = { nounwind }
45
46...
47---
48name:            test_basic
49alignment:       16
50exposesReturnsTwice: false
51legalized:       false
52regBankSelected: false
53selected:        false
54failedISel:      false
55tracksRegLiveness: true
56hasWinCFI:       false
57registers:       []
58liveins:
59  - { reg: '$rdi', virtual-reg: '' }
60  - { reg: '$rsi', virtual-reg: '' }
61frameInfo:
62  isFrameAddressTaken: false
63  isReturnAddressTaken: false
64  hasStackMap:     false
65  hasPatchPoint:   false
66  stackSize:       0
67  offsetAdjustment: 0
68  maxAlignment:    1
69  adjustsStack:    false
70  hasCalls:        true
71  stackProtector:  ''
72  maxCallFrameSize: 4294967295
73  cvBytesOfCalleeSavedRegisters: 0
74  hasOpaqueSPAdjustment: false
75  hasVAStart:      false
76  hasMustTailInVarArgFunc: false
77  localFrameSize:  0
78  savePoint:       ''
79  restorePoint:    ''
80fixedStack:      []
81stack:           []
82callSites:       []
83constants:       []
84machineFunctionInfo: {}
85body:             |
86  ; CHECK-LABEL: name: test_basic
87  ; CHECK: bb.0.entry:
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 8 into %stack.0)
91  ; CHECK-DAG:   MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi :: (store 8 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 8 on %stack.1), (load store 8 on %stack.0)
95  ; CHECK-DAG:   $r14 = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load 8 from %stack.0)
96  ; CHECK-DAG:   $rbx = MOV64rm %stack.1, 1, $noreg, 0, $noreg :: (load 8 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>
99  ; CHECK:   JMP_1 %bb.1
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
106  ; CHECK:   RET 0, $rax
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 8 from %stack.0)
111  ; CHECK-DAG:   $rbx = MOV64rm %stack.1, 1, $noreg, 0, $noreg :: (load 8 from %stack.1)
112  ; CHECK:   $rax = COPY killed renamable $r14
113  ; CHECK:   RET 0, $rax
114  bb.0.entry:
115    successors: %bb.1(0x7ffff800), %bb.3(0x00000800)
116    liveins: $rdi, $rsi
117
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>
125    JMP_1 %bb.1
126
127  bb.1.invoke_safepoint_normal_dest:
128    successors: %bb.2(0x80000000)
129    liveins: $rbx
130
131
132  bb.2.normal_return:
133    liveins: $rbx
134
135    $rax = COPY killed renamable $rbx
136    RET 0, $rax
137
138  bb.3.exceptional_return (landing-pad):
139    liveins: $rax, $rdx, $r14
140
141    EH_LABEL <mcsymbol .Ltmp2>
142    $rax = COPY killed renamable $r14
143    RET 0, $rax
144
145...
146