[PATCH] D145934: [RISCV] Precommit test to show wrong way to pass scaleable vector on stack

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 07:19:06 PDT 2023


kito-cheng added a comment.

Add comments for easier understand what's wrong for the current code gen.



================
Comment at: llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
+; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs -treat-scalable-fixed-error-as-warning < %s 2>&1 | FileCheck %s
+
----------------
`-treat-scalable-fixed-error-as-warning` to prevent llvm crash


================
Comment at: llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll:4
+
+; CHECK: warning: Invalid size request on a scalable vector
+
----------------
This should not happened, will turn into CHECK-NOT in follow up patch.


================
Comment at: llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll:9
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    addi sp, sp, -16
+; CHECK-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
----------------
Stack only reserve 16 byte, 8 byte for backup sp...which mean only left 8 byte for a LMUL 8 value.


================
Comment at: llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll:11
+; CHECK-NEXT:    sd ra, 8(sp) # 8-byte Folded Spill
+; CHECK-NEXT:    vsetvli a0, zero, e32, m8, ta, ma
+; CHECK-NEXT:    vmv.v.i v8, 0
----------------
Set `vl` to `vlmax` here


================
Comment at: llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll:13
+; CHECK-NEXT:    vmv.v.i v8, 0
+; CHECK-NEXT:    vs8r.v v8, (sp)
+; CHECK-NEXT:    li a0, 0
----------------
And then store an LMUL 8 value to stack, stack corruption here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145934/new/

https://reviews.llvm.org/D145934



More information about the llvm-commits mailing list