1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=prologepilog -simplify-mir -o - %s | FileCheck %s
3 # verify live-on-entry registers are not marked killed by spills
6 declare void @vararg(i32 signext, ...)
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)
20 ; Function Attrs: nofree nosync nounwind readnone willreturn
21 declare i8* @llvm.returnaddress(i32 immarg) #0
23 attributes #0 = { nofree nosync nounwind readnone willreturn }
29 exposesReturnsTwice: false
31 regBankSelected: false
34 tracksRegLiveness: true
38 - { reg: '$x1', virtual-reg: '' }
40 isFrameAddressTaken: false
41 isReturnAddressTaken: true
50 maxCallFrameSize: 4294967295
51 cvBytesOfCalleeSavedRegisters: 0
52 hasOpaqueSPAdjustment: false
54 hasMustTailInVarArgFunc: false
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: '' }
65 debugValueSubstitutions: []
67 machineFunctionInfo: {}
72 ; CHECK-LABEL: name: test1
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-call) @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
90 PseudoCALL target-flags(riscv-call) @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