|
| 1 | +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| 2 | +# RUN: llc -march=riscv64 -run-pass=prologepilog -simplify-mir -o - %s | FileCheck %s |
| 3 | +# verify live-on-entry registers are not marked killed by spills |
| 4 | +--- | |
| 5 | + |
| 6 | + declare void @vararg(i32 signext, ...) |
| 7 | + |
| 8 | + define void @test1() { |
| 9 | + entry: |
| 10 | + %a = alloca i32, align 4 |
| 11 | + %0 = call i8* @llvm.returnaddress(i32 0) |
| 12 | + %1 = ptrtoint i8* %0 to i64 |
| 13 | + %conv = trunc i64 %1 to i32 |
| 14 | + store i32 %conv, i32* %a, align 4 |
| 15 | + %2 = load i32, i32* %a, align 4 |
| 16 | + call void (i32, ...) @vararg(i32 signext 0, i32 signext %2) |
| 17 | + ret void |
| 18 | + } |
| 19 | + |
| 20 | + ; Function Attrs: nofree nosync nounwind readnone willreturn |
| 21 | + declare i8* @llvm.returnaddress(i32 immarg) #0 |
| 22 | + |
| 23 | + attributes #0 = { nofree nosync nounwind readnone willreturn } |
| 24 | + |
| 25 | +... |
| 26 | +--- |
| 27 | +name: test1 |
| 28 | +alignment: 4 |
| 29 | +exposesReturnsTwice: false |
| 30 | +legalized: false |
| 31 | +regBankSelected: false |
| 32 | +selected: false |
| 33 | +failedISel: false |
| 34 | +tracksRegLiveness: true |
| 35 | +hasWinCFI: false |
| 36 | +registers: [] |
| 37 | +liveins: |
| 38 | + - { reg: '$x1', virtual-reg: '' } |
| 39 | +frameInfo: |
| 40 | + isFrameAddressTaken: false |
| 41 | + isReturnAddressTaken: true |
| 42 | + hasStackMap: false |
| 43 | + hasPatchPoint: false |
| 44 | + stackSize: 0 |
| 45 | + offsetAdjustment: 0 |
| 46 | + maxAlignment: 4 |
| 47 | + adjustsStack: false |
| 48 | + hasCalls: true |
| 49 | + stackProtector: '' |
| 50 | + maxCallFrameSize: 4294967295 |
| 51 | + cvBytesOfCalleeSavedRegisters: 0 |
| 52 | + hasOpaqueSPAdjustment: false |
| 53 | + hasVAStart: false |
| 54 | + hasMustTailInVarArgFunc: false |
| 55 | + hasTailCall: false |
| 56 | + localFrameSize: 0 |
| 57 | + savePoint: '' |
| 58 | + restorePoint: '' |
| 59 | +fixedStack: [] |
| 60 | +stack: |
| 61 | + - { id: 0, name: a, type: default, offset: 0, size: 4, alignment: 4, |
| 62 | + stack-id: default, callee-saved-register: '', callee-saved-restored: true, |
| 63 | + debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } |
| 64 | +callSites: [] |
| 65 | +debugValueSubstitutions: [] |
| 66 | +constants: [] |
| 67 | +machineFunctionInfo: {} |
| 68 | +body: | |
| 69 | + bb.0.entry: |
| 70 | + liveins: $x1 |
| 71 | +
|
| 72 | + ; CHECK-LABEL: name: test1 |
| 73 | + ; CHECK: liveins: $x1 |
| 74 | + ; CHECK-NEXT: {{ $}} |
| 75 | + ; CHECK-NEXT: $x2 = frame-setup ADDI $x2, -16 |
| 76 | + ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16 |
| 77 | + ; CHECK-NEXT: SD $x1, $x2, 8 :: (store (s64) into %stack.1) |
| 78 | + ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $x1, -8 |
| 79 | + ; CHECK-NEXT: SW renamable $x1, $x2, 4 :: (store (s32) into %ir.a) |
| 80 | + ; CHECK-NEXT: renamable $x11 = ADDIW killed renamable $x1, 0 |
| 81 | + ; CHECK-NEXT: $x10 = COPY $x0 |
| 82 | + ; CHECK-NEXT: PseudoCALL target-flags(riscv-plt) @vararg, csr_ilp32_lp64, implicit-def dead $x1, implicit killed $x10, implicit $x11, implicit-def $x2 |
| 83 | + ; CHECK-NEXT: $x1 = LD $x2, 8 :: (load (s64) from %stack.1) |
| 84 | + ; CHECK-NEXT: $x2 = frame-destroy ADDI $x2, 16 |
| 85 | + ; CHECK-NEXT: PseudoRET |
| 86 | + SW renamable $x1, %stack.0.a, 0 :: (store (s32) into %ir.a) |
| 87 | + renamable $x11 = ADDIW killed renamable $x1, 0 |
| 88 | + ADJCALLSTACKDOWN 0, 0, implicit-def dead $x2, implicit $x2 |
| 89 | + $x10 = COPY $x0 |
| 90 | + PseudoCALL target-flags(riscv-plt) @vararg, csr_ilp32_lp64, implicit-def dead $x1, implicit killed $x10, implicit $x11, implicit-def $x2 |
| 91 | + ADJCALLSTACKUP 0, 0, implicit-def dead $x2, implicit $x2 |
| 92 | + PseudoRET |
| 93 | +
|
| 94 | +... |
0 commit comments