|
| 1 | +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 |
| 2 | +# RUN: llc -mtriple=riscv64 -x mir -run-pass=prologepilog -verify-machineinstrs < %s \ |
| 3 | +# RUN: | FileCheck %s -check-prefixes=RV64I |
| 4 | +# RUN: llc -mtriple=riscv32 -x mir -run-pass=prologepilog -verify-machineinstrs < %s \ |
| 5 | +# RUN: | FileCheck %s -check-prefixes=RV32I |
| 6 | +--- | |
| 7 | + ; Function Attrs: uwtable |
| 8 | + define void @no_reserved_call_frame(i64 %n) #0 { |
| 9 | + entry: |
| 10 | + %v = alloca i32, i64 %n, align 4 |
| 11 | + call void @callee_stack_args(ptr %v, [518 x i64] poison) |
| 12 | + ret void |
| 13 | + } |
| 14 | + |
| 15 | + declare void @callee_stack_args(ptr, [518 x i64]) #1 |
| 16 | + |
| 17 | + attributes #0 = { uwtable "frame-pointer"="none" "probe-stack"="inline-asm" "target-features"="+m" } |
| 18 | + attributes #1 = { "target-features"="+m" } |
| 19 | +... |
| 20 | +--- |
| 21 | +name: no_reserved_call_frame |
| 22 | +alignment: 4 |
| 23 | +exposesReturnsTwice: false |
| 24 | +legalized: false |
| 25 | +regBankSelected: false |
| 26 | +selected: false |
| 27 | +failedISel: false |
| 28 | +tracksRegLiveness: true |
| 29 | +hasWinCFI: false |
| 30 | +noPhis: true |
| 31 | +isSSA: false |
| 32 | +noVRegs: true |
| 33 | +hasFakeUses: false |
| 34 | +callsEHReturn: false |
| 35 | +callsUnwindInit: false |
| 36 | +hasEHContTarget: false |
| 37 | +hasEHScopes: false |
| 38 | +hasEHFunclets: false |
| 39 | +isOutlined: false |
| 40 | +debugInstrRef: false |
| 41 | +failsVerification: false |
| 42 | +tracksDebugUserValues: true |
| 43 | +registers: [] |
| 44 | +liveins: |
| 45 | + - { reg: '$x10', virtual-reg: '' } |
| 46 | +frameInfo: |
| 47 | + isFrameAddressTaken: false |
| 48 | + isReturnAddressTaken: false |
| 49 | + hasStackMap: false |
| 50 | + hasPatchPoint: false |
| 51 | + stackSize: 0 |
| 52 | + offsetAdjustment: 0 |
| 53 | + maxAlignment: 8 |
| 54 | + adjustsStack: true |
| 55 | + hasCalls: true |
| 56 | + stackProtector: '' |
| 57 | + functionContext: '' |
| 58 | + maxCallFrameSize: 4294967295 |
| 59 | + cvBytesOfCalleeSavedRegisters: 0 |
| 60 | + hasOpaqueSPAdjustment: false |
| 61 | + hasVAStart: false |
| 62 | + hasMustTailInVarArgFunc: false |
| 63 | + hasTailCall: false |
| 64 | + isCalleeSavedInfoValid: false |
| 65 | + localFrameSize: 0 |
| 66 | + savePoint: '' |
| 67 | + restorePoint: '' |
| 68 | +fixedStack: [] |
| 69 | +stack: |
| 70 | + - { id: 0, name: v, type: variable-sized, offset: 0, alignment: 1, stack-id: default, |
| 71 | + callee-saved-register: '', callee-saved-restored: true, local-offset: 0, |
| 72 | + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } |
| 73 | +entry_values: [] |
| 74 | +callSites: [] |
| 75 | +debugValueSubstitutions: [] |
| 76 | +constants: [] |
| 77 | +machineFunctionInfo: |
| 78 | + varArgsFrameIndex: 0 |
| 79 | + varArgsSaveSize: 0 |
| 80 | +body: | |
| 81 | + ; RV64I-LABEL: name: no_reserved_call_frame |
| 82 | + ; RV64I: bb.0.entry: |
| 83 | + ; RV64I-NEXT: successors: %bb.1(0x80000000) |
| 84 | + ; RV64I-NEXT: liveins: $x10, $x1 |
| 85 | + ; RV64I-NEXT: {{ $}} |
| 86 | + ; RV64I-NEXT: $x2 = frame-setup ADDI $x2, -16 |
| 87 | + ; RV64I-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 |
| 88 | + ; RV64I-NEXT: frame-setup SD killed $x1, $x2, 8 :: (store (s64) into %stack.1) |
| 89 | + ; RV64I-NEXT: frame-setup SD killed $x8, $x2, 0 :: (store (s64) into %stack.2) |
| 90 | + ; RV64I-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 |
| 91 | + ; RV64I-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -16 |
| 92 | + ; RV64I-NEXT: $x8 = frame-setup ADDI $x2, 16 |
| 93 | + ; RV64I-NEXT: frame-setup CFI_INSTRUCTION def_cfa $x8, 0 |
| 94 | + ; RV64I-NEXT: renamable $x10 = SLLI killed renamable $x10, 2 |
| 95 | + ; RV64I-NEXT: renamable $x10 = nuw ADDI killed renamable $x10, 15 |
| 96 | + ; RV64I-NEXT: renamable $x10 = ANDI killed renamable $x10, -16 |
| 97 | + ; RV64I-NEXT: renamable $x10 = SUB $x2, killed renamable $x10 |
| 98 | + ; RV64I-NEXT: renamable $x11 = LUI 1 |
| 99 | + ; RV64I-NEXT: {{ $}} |
| 100 | + ; RV64I-NEXT: bb.1.entry: |
| 101 | + ; RV64I-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000) |
| 102 | + ; RV64I-NEXT: liveins: $x10, $x11 |
| 103 | + ; RV64I-NEXT: {{ $}} |
| 104 | + ; RV64I-NEXT: $x2 = SUB $x2, renamable $x11 |
| 105 | + ; RV64I-NEXT: SD $x0, $x2, 0 |
| 106 | + ; RV64I-NEXT: BLT renamable $x10, $x2, %bb.1 |
| 107 | + ; RV64I-NEXT: {{ $}} |
| 108 | + ; RV64I-NEXT: bb.2.entry: |
| 109 | + ; RV64I-NEXT: liveins: $x10 |
| 110 | + ; RV64I-NEXT: {{ $}} |
| 111 | + ; RV64I-NEXT: $x2 = ADDI renamable $x10, 0 |
| 112 | + ; RV64I-NEXT: $x11 = LUI 1 |
| 113 | + ; RV64I-NEXT: $x2 = SUB $x2, killed $x11 |
| 114 | + ; RV64I-NEXT: PseudoCALL target-flags(riscv-call) @callee_stack_args, csr_ilp32_lp64, implicit-def dead $x1, implicit $x10, implicit undef $x11, implicit undef $x12, implicit undef $x13, implicit undef $x14, implicit undef $x15, implicit undef $x16, implicit undef $x17, implicit-def $x2 |
| 115 | + ; RV64I-NEXT: $x10 = LUI 1 |
| 116 | + ; RV64I-NEXT: $x2 = ADD $x2, killed $x10 |
| 117 | + ; RV64I-NEXT: $x2 = frame-destroy ADDI $x8, -16 |
| 118 | + ; RV64I-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $x2, 16 |
| 119 | + ; RV64I-NEXT: $x1 = frame-destroy LD $x2, 8 :: (load (s64) from %stack.1) |
| 120 | + ; RV64I-NEXT: $x8 = frame-destroy LD $x2, 0 :: (load (s64) from %stack.2) |
| 121 | + ; RV64I-NEXT: frame-destroy CFI_INSTRUCTION restore $x1 |
| 122 | + ; RV64I-NEXT: frame-destroy CFI_INSTRUCTION restore $x8 |
| 123 | + ; RV64I-NEXT: $x2 = frame-destroy ADDI $x2, 16 |
| 124 | + ; RV64I-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0 |
| 125 | + ; RV64I-NEXT: PseudoRET |
| 126 | + ; |
| 127 | + ; RV32I-LABEL: name: no_reserved_call_frame |
| 128 | + ; RV32I: bb.0.entry: |
| 129 | + ; RV32I-NEXT: successors: %bb.1(0x80000000) |
| 130 | + ; RV32I-NEXT: liveins: $x10, $x1 |
| 131 | + ; RV32I-NEXT: {{ $}} |
| 132 | + ; RV32I-NEXT: $x2 = frame-setup ADDI $x2, -16 |
| 133 | + ; RV32I-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 |
| 134 | + ; RV32I-NEXT: frame-setup SW killed $x1, $x2, 12 :: (store (s32) into %stack.1) |
| 135 | + ; RV32I-NEXT: frame-setup SW killed $x8, $x2, 8 :: (store (s32) into %stack.2) |
| 136 | + ; RV32I-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -4 |
| 137 | + ; RV32I-NEXT: frame-setup CFI_INSTRUCTION offset $x8, -8 |
| 138 | + ; RV32I-NEXT: $x8 = frame-setup ADDI $x2, 16 |
| 139 | + ; RV32I-NEXT: frame-setup CFI_INSTRUCTION def_cfa $x8, 0 |
| 140 | + ; RV32I-NEXT: renamable $x10 = SLLI killed renamable $x10, 2 |
| 141 | + ; RV32I-NEXT: renamable $x10 = nuw ADDI killed renamable $x10, 15 |
| 142 | + ; RV32I-NEXT: renamable $x10 = ANDI killed renamable $x10, -16 |
| 143 | + ; RV32I-NEXT: renamable $x10 = SUB $x2, killed renamable $x10 |
| 144 | + ; RV32I-NEXT: renamable $x11 = LUI 1 |
| 145 | + ; RV32I-NEXT: {{ $}} |
| 146 | + ; RV32I-NEXT: bb.1.entry: |
| 147 | + ; RV32I-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000) |
| 148 | + ; RV32I-NEXT: liveins: $x10, $x11 |
| 149 | + ; RV32I-NEXT: {{ $}} |
| 150 | + ; RV32I-NEXT: $x2 = SUB $x2, renamable $x11 |
| 151 | + ; RV32I-NEXT: SD $x0, $x2, 0 |
| 152 | + ; RV32I-NEXT: BLT renamable $x10, $x2, %bb.1 |
| 153 | + ; RV32I-NEXT: {{ $}} |
| 154 | + ; RV32I-NEXT: bb.2.entry: |
| 155 | + ; RV32I-NEXT: liveins: $x10 |
| 156 | + ; RV32I-NEXT: {{ $}} |
| 157 | + ; RV32I-NEXT: $x2 = ADDI renamable $x10, 0 |
| 158 | + ; RV32I-NEXT: $x11 = LUI 1 |
| 159 | + ; RV32I-NEXT: $x2 = SUB $x2, killed $x11 |
| 160 | + ; RV32I-NEXT: PseudoCALL target-flags(riscv-call) @callee_stack_args, csr_ilp32_lp64, implicit-def dead $x1, implicit $x10, implicit undef $x11, implicit undef $x12, implicit undef $x13, implicit undef $x14, implicit undef $x15, implicit undef $x16, implicit undef $x17, implicit-def $x2 |
| 161 | + ; RV32I-NEXT: $x10 = LUI 1 |
| 162 | + ; RV32I-NEXT: $x2 = ADD $x2, killed $x10 |
| 163 | + ; RV32I-NEXT: $x2 = frame-destroy ADDI $x8, -16 |
| 164 | + ; RV32I-NEXT: frame-destroy CFI_INSTRUCTION def_cfa $x2, 16 |
| 165 | + ; RV32I-NEXT: $x1 = frame-destroy LW $x2, 12 :: (load (s32) from %stack.1) |
| 166 | + ; RV32I-NEXT: $x8 = frame-destroy LW $x2, 8 :: (load (s32) from %stack.2) |
| 167 | + ; RV32I-NEXT: frame-destroy CFI_INSTRUCTION restore $x1 |
| 168 | + ; RV32I-NEXT: frame-destroy CFI_INSTRUCTION restore $x8 |
| 169 | + ; RV32I-NEXT: $x2 = frame-destroy ADDI $x2, 16 |
| 170 | + ; RV32I-NEXT: frame-destroy CFI_INSTRUCTION def_cfa_offset 0 |
| 171 | + ; RV32I-NEXT: PseudoRET |
| 172 | + bb.0.entry: |
| 173 | + successors: %bb.1(0x80000000) |
| 174 | + liveins: $x10 |
| 175 | +
|
| 176 | + renamable $x10 = SLLI killed renamable $x10, 2 |
| 177 | + renamable $x10 = nuw ADDI killed renamable $x10, 15 |
| 178 | + renamable $x10 = ANDI killed renamable $x10, -16 |
| 179 | + renamable $x10 = SUB $x2, killed renamable $x10 |
| 180 | + renamable $x11 = LUI 1 |
| 181 | +
|
| 182 | + bb.1.entry: |
| 183 | + successors: %bb.2(0x40000000), %bb.1(0x40000000) |
| 184 | + liveins: $x10, $x11 |
| 185 | +
|
| 186 | + $x2 = SUB $x2, renamable $x11 |
| 187 | + SD $x0, $x2, 0 |
| 188 | + BLT renamable $x10, $x2, %bb.1 |
| 189 | +
|
| 190 | + bb.2.entry: |
| 191 | + liveins: $x10 |
| 192 | +
|
| 193 | + $x2 = ADDI renamable $x10, 0 |
| 194 | + ADJCALLSTACKDOWN 4088, 0, implicit-def dead $x2, implicit $x2 |
| 195 | + PseudoCALL target-flags(riscv-call) @callee_stack_args, csr_ilp32_lp64, implicit-def dead $x1, implicit $x10, implicit undef $x11, implicit undef $x12, implicit undef $x13, implicit undef $x14, implicit undef $x15, implicit undef $x16, implicit undef $x17, implicit-def $x2 |
| 196 | + ADJCALLSTACKUP 4088, 0, implicit-def dead $x2, implicit $x2 |
| 197 | + PseudoRET |
| 198 | +... |
0 commit comments