Compiler projects using llvm
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple riscv64 -mattr=+m,+v -run-pass=prologepilog -o - \
# RUN:     -verify-machineinstrs %s | FileCheck %s
--- |
  target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
  target triple = "riscv64"

  define void @spillslot() {
    ret void
  }

...
---
name:            spillslot
alignment:       4
tracksRegLiveness: true
liveins:
  - { reg: '$x12', virtual-reg: '' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    128
  adjustsStack:    false
  hasCalls:        false
  stackProtector:  ''
  maxCallFrameSize: 4294967295
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  hasTailCall:     false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:      []
stack:
  - { id: 0, name: '', type: default, offset: 0, size: 2048, alignment: 128,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
  - { id: 1, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8,
      stack-id: scalable-vector, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
  - { id: 2, name: '', type: spill-slot, offset: 0, size: 400, alignment: 8,
      stack-id: scalable-vector, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
body:             |
  ; CHECK-LABEL: name: spillslot
  ; CHECK: bb.0:
  ; CHECK-NEXT:   successors: %bb.1(0x40000000), %bb.2(0x40000000)
  ; CHECK-NEXT:   liveins: $x12, $x1, $x18, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   $x2 = frame-setup ADDI $x2, -2032
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION def_cfa_offset 2032
  ; CHECK-NEXT:   SD killed $x1, $x2, 2024 :: (store (s64) into %stack.3)
  ; CHECK-NEXT:   SD killed $x8, $x2, 2016 :: (store (s64) into %stack.4)
  ; CHECK-NEXT:   SD killed $x18, $x2, 2008 :: (store (s64) into %stack.5)
  ; CHECK-NEXT:   SD killed $x19, $x2, 2000 :: (store (s64) into %stack.6)
  ; CHECK-NEXT:   SD killed $x20, $x2, 1992 :: (store (s64) into %stack.7)
  ; CHECK-NEXT:   SD killed $x21, $x2, 1984 :: (store (s64) into %stack.8)
  ; CHECK-NEXT:   SD killed $x22, $x2, 1976 :: (store (s64) into %stack.9)
  ; CHECK-NEXT:   SD killed $x23, $x2, 1968 :: (store (s64) into %stack.10)
  ; CHECK-NEXT:   SD killed $x24, $x2, 1960 :: (store (s64) into %stack.11)
  ; CHECK-NEXT:   SD killed $x25, $x2, 1952 :: (store (s64) into %stack.12)
  ; CHECK-NEXT:   SD killed $x26, $x2, 1944 :: (store (s64) into %stack.13)
  ; CHECK-NEXT:   SD killed $x27, $x2, 1936 :: (store (s64) into %stack.14)
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x1, -8
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x8, -16
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x18, -24
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x19, -32
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x20, -40
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x21, -48
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x22, -56
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x23, -64
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x24, -72
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x25, -80
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x26, -88
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION offset $x27, -96
  ; CHECK-NEXT:   $x8 = frame-setup ADDI $x2, 2032
  ; CHECK-NEXT:   frame-setup CFI_INSTRUCTION def_cfa $x8, 0
  ; CHECK-NEXT:   $x2 = frame-setup ADDI $x2, -272
  ; CHECK-NEXT:   $x10 = frame-setup PseudoReadVLENB
  ; CHECK-NEXT:   $x11 = frame-setup ADDI killed $x0, 52
  ; CHECK-NEXT:   $x10 = frame-setup MUL killed $x10, killed $x11
  ; CHECK-NEXT:   $x2 = frame-setup SUB $x2, killed $x10
  ; CHECK-NEXT:   $x2 = frame-setup ANDI $x2, -128
  ; CHECK-NEXT:   dead renamable $x15 = PseudoVSETIVLI 1, 72 /* e16, m1, ta, mu */, implicit-def $vl, implicit-def $vtype
  ; CHECK-NEXT:   renamable $v25 = PseudoVMV_V_X_M1 killed renamable $x12, $noreg, 4 /* e16 */, implicit $vl, implicit $vtype
  ; CHECK-NEXT:   $x11 = PseudoReadVLENB
  ; CHECK-NEXT:   $x10 = ADDI killed $x0, 50
  ; CHECK-NEXT:   $x11 = MUL killed $x11, killed $x10
  ; CHECK-NEXT:   $x10 = LUI 1
  ; CHECK-NEXT:   $x10 = ADDIW killed $x10, -1888
  ; CHECK-NEXT:   $x10 = ADD $x2, killed $x10
  ; CHECK-NEXT:   $x10 = ADD killed $x10, killed $x11
  ; CHECK-NEXT:   PseudoVSPILL_M1 killed renamable $v25, killed $x10 :: (store unknown-size into %stack.1, align 8)
  ; CHECK-NEXT:   renamable $x1 = ADDI $x0, 255
  ; CHECK-NEXT:   renamable $x5 = nuw ADDI $x2, 384
  ; CHECK-NEXT:   renamable $x6 = ADDI $x2, 512
  ; CHECK-NEXT:   renamable $x7 = nuw ADDI $x2, 640
  ; CHECK-NEXT:   renamable $x10 = ADDI $x0, 128
  ; CHECK-NEXT:   renamable $x12 = nuw ADDI $x2, 256
  ; CHECK-NEXT:   renamable $x14 = COPY $x0
  ; CHECK-NEXT:   renamable $x17 = nuw ADDI $x2, 256
  ; CHECK-NEXT:   renamable $x18 = ADDI $x2, 1280
  ; CHECK-NEXT:   renamable $x19 = ADDI $x2, 1408
  ; CHECK-NEXT:   renamable $x20 = ADDI $x2, 1536
  ; CHECK-NEXT:   renamable $x21 = ADDI $x2, 1664
  ; CHECK-NEXT:   renamable $x22 = ADDI $x2, 1792
  ; CHECK-NEXT:   renamable $x23 = ADDI $x2, 1920
  ; CHECK-NEXT:   SD killed $x1, $x2, 8 :: (store (s64) into %stack.15)
  ; CHECK-NEXT:   SD killed $x5, $x2, 0 :: (store (s64) into %stack.16)
  ; CHECK-NEXT:   $x11 = LUI 1
  ; CHECK-NEXT:   $x11 = ADDIW killed $x11, -2048
  ; CHECK-NEXT:   $x24 = ADD $x2, killed $x11
  ; CHECK-NEXT:   renamable $x25 = ADDI $x2, 128
  ; CHECK-NEXT:   renamable $x26 = ADDI $x2, 128
  ; CHECK-NEXT:   renamable $x27 = ADDI $x0, 2
  ; CHECK-NEXT:   renamable $x28 = ADDI $x2, 768
  ; CHECK-NEXT:   renamable $x29 = ADDI $x2, 896
  ; CHECK-NEXT:   renamable $x30 = ADDI $x2, 1024
  ; CHECK-NEXT:   renamable $x31 = nuw ADDI $x2, 1152
  ; CHECK-NEXT:   renamable $x15 = ADDIW renamable $x14, 0
  ; CHECK-NEXT:   renamable $x11 = ANDI renamable $x15, 255
  ; CHECK-NEXT:   renamable $x13 = SLLI renamable $x11, 3
  ; CHECK-NEXT:   renamable $x13 = ADD renamable $x26, killed renamable $x13
  ; CHECK-NEXT:   renamable $x13 = LD killed renamable $x13, 0 :: (load (s64))
  ; CHECK-NEXT:   renamable $x16 = SUB killed renamable $x13, renamable $x13
  ; CHECK-NEXT:   dead renamable $x13 = PseudoVSETIVLI 1, 64 /* e8, m1, ta, mu */, implicit-def $vl, implicit-def $vtype
  ; CHECK-NEXT:   renamable $x13 = nsw ADDI renamable $x16, -2
  ; CHECK-NEXT:   $x5 = PseudoReadVLENB
  ; CHECK-NEXT:   $x1 = ADDI killed $x0, 50
  ; CHECK-NEXT:   $x5 = MUL killed $x5, killed $x1
  ; CHECK-NEXT:   $x1 = LUI 1
  ; CHECK-NEXT:   $x1 = ADDIW killed $x1, -1888
  ; CHECK-NEXT:   $x1 = ADD $x2, killed $x1
  ; CHECK-NEXT:   $x1 = ADD killed $x1, killed $x5
  ; CHECK-NEXT:   $x5 = LD $x2, 0 :: (load (s64) from %stack.16)
  ; CHECK-NEXT:   renamable $v0 = PseudoVRELOAD_M1 killed $x1 :: (load unknown-size from %stack.1, align 8)
  ; CHECK-NEXT:   $x1 = LD $x2, 8 :: (load (s64) from %stack.15)
  ; CHECK-NEXT:   renamable $v0 = PseudoVSLIDEDOWN_VX_M1 undef renamable $v0, killed renamable $v0, killed renamable $x13, $noreg, 3 /* e8 */, 1, implicit $vl, implicit $vtype
  ; CHECK-NEXT:   renamable $x13 = PseudoVMV_X_S_M1 killed renamable $v0, 3 /* e8 */, implicit $vl, implicit $vtype
  ; CHECK-NEXT:   BLT killed renamable $x16, renamable $x27, %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.1:
  ; CHECK-NEXT:   successors: %bb.2(0x80000000)
  ; CHECK-NEXT:   liveins: $x1, $x5, $x6, $x7, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x17, $x18, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $x29, $x30, $x31
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT:   renamable $x10 = COPY killed renamable $x13
  ; CHECK-NEXT:   PseudoBR %bb.2
  ; CHECK-NEXT: {{  $}}
  ; CHECK-NEXT: bb.2:
  ; CHECK-NEXT:   $x2 = frame-destroy ADDI $x8, -2048
  ; CHECK-NEXT:   $x2 = frame-destroy ADDI killed $x2, -256
  ; CHECK-NEXT:   $x2 = frame-destroy ADDI $x2, 272
  ; CHECK-NEXT:   $x1 = LD $x2, 2024 :: (load (s64) from %stack.3)
  ; CHECK-NEXT:   $x8 = LD $x2, 2016 :: (load (s64) from %stack.4)
  ; CHECK-NEXT:   $x18 = LD $x2, 2008 :: (load (s64) from %stack.5)
  ; CHECK-NEXT:   $x19 = LD $x2, 2000 :: (load (s64) from %stack.6)
  ; CHECK-NEXT:   $x20 = LD $x2, 1992 :: (load (s64) from %stack.7)
  ; CHECK-NEXT:   $x21 = LD $x2, 1984 :: (load (s64) from %stack.8)
  ; CHECK-NEXT:   $x22 = LD $x2, 1976 :: (load (s64) from %stack.9)
  ; CHECK-NEXT:   $x23 = LD $x2, 1968 :: (load (s64) from %stack.10)
  ; CHECK-NEXT:   $x24 = LD $x2, 1960 :: (load (s64) from %stack.11)
  ; CHECK-NEXT:   $x25 = LD $x2, 1952 :: (load (s64) from %stack.12)
  ; CHECK-NEXT:   $x26 = LD $x2, 1944 :: (load (s64) from %stack.13)
  ; CHECK-NEXT:   $x27 = LD $x2, 1936 :: (load (s64) from %stack.14)
  ; CHECK-NEXT:   $x2 = frame-destroy ADDI $x2, 2032
  ; CHECK-NEXT:   PseudoRET
  bb.0:
    successors: %bb.1, %bb.2
    liveins: $x12

    dead renamable $x15 = PseudoVSETIVLI 1, 72, implicit-def $vl, implicit-def $vtype
    renamable $v25 = PseudoVMV_V_X_M1 killed renamable $x12, $noreg, 4, implicit $vl, implicit $vtype
    PseudoVSPILL_M1 killed renamable $v25, %stack.1 :: (store unknown-size into %stack.1, align 8)
    renamable $x1 = ADDI $x0, 255
    renamable $x5 = nuw ADDI %stack.0, 256
    renamable $x6 = ADDI %stack.0, 384
    renamable $x7 = nuw ADDI %stack.0, 512
    renamable $x10 = ADDI $x0, 128
    renamable $x12 = nuw ADDI %stack.0, 128
    renamable $x14 = COPY $x0
    renamable $x17 = nuw ADDI %stack.0, 128
    renamable $x18 = ADDI %stack.0, 1152
    renamable $x19 = ADDI %stack.0, 1280
    renamable $x20 = ADDI %stack.0, 1408
    renamable $x21 = ADDI %stack.0, 1536
    renamable $x22 = ADDI %stack.0, 1664
    renamable $x23 = ADDI %stack.0, 1792
    renamable $x24 = ADDI %stack.0, 1920
    renamable $x25 = ADDI %stack.0, 0
    renamable $x26 = ADDI %stack.0, 0
    renamable $x27 = ADDI $x0, 2
    renamable $x28 = ADDI %stack.0, 640
    renamable $x29 = ADDI %stack.0, 768
    renamable $x30 = ADDI %stack.0, 896
    renamable $x31 = nuw ADDI %stack.0, 1024
    renamable $x15 = ADDIW renamable $x14, 0
    renamable $x11 = ANDI renamable $x15, 255
    renamable $x13 = SLLI renamable $x11, 3
    renamable $x13 = ADD renamable $x26, killed renamable $x13
    renamable $x13 = LD killed renamable $x13, 0 :: (load (s64))
    renamable $x16 = SUB killed renamable $x13, renamable $x13
    dead renamable $x13 = PseudoVSETIVLI 1, 64, implicit-def $vl, implicit-def $vtype
    renamable $x13 = nsw ADDI renamable $x16, -2
    renamable $v0 = PseudoVRELOAD_M1 %stack.1 :: (load unknown-size from %stack.1, align 8)
    renamable $v0 = PseudoVSLIDEDOWN_VX_M1 undef renamable $v0, killed renamable $v0, killed renamable $x13, $noreg, 3, 1, implicit $vl, implicit $vtype
    renamable $x13 = PseudoVMV_X_S_M1 killed renamable $v0, 3, implicit $vl, implicit $vtype
    BLT killed renamable $x16, renamable $x27, %bb.2

  bb.1:
    successors: %bb.2
    liveins: $x1, $x5, $x6, $x7, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x17, $x18, $x19, $x20, $x21, $x22, $x23, $x24, $x25, $x26, $x27, $x28, $x29, $x30, $x31

    renamable $x10 = COPY killed renamable $x13
    PseudoBR %bb.2

  bb.2:
    PseudoRET
...