[all-commits] [llvm/llvm-project] ba1c77: [RISCV] Precommit test to show wrong way to pass s...

Kito Cheng via All-commits all-commits at lists.llvm.org
Wed Mar 15 02:21:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba1c7731f15bb51253316180330d60f16fe3c5b7
      https://github.com/llvm/llvm-project/commit/ba1c7731f15bb51253316180330d60f16fe3c5b7
  Author: Kito Cheng <kito.cheng at sifive.com>
  Date:   2023-03-15 (Wed, 15 Mar 2023)

  Changed paths:
    A llvm/test/CodeGen/RISCV/calling-conv-vector-on-stack.ll

  Log Message:
  -----------
  [RISCV] Precommit test to show wrong way to pass scalable FP vector on stack

Test case to demo scaleable vector on stack will cause stack corruption.

Detail explan what happened:

```
tail call void @foo(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
                    <vscale x 16 x float> zeroinitializer,
                    <vscale x 16 x float> zeroinitializer,
                    <vscale x 16 x float> zeroinitializer)
```

`foo` take 13 arguments, first 8 argument pass in GPR, and next 2 LMUL 8 vector
arguments passed in v8-v23, and now we run out of argument register for GPR and
vector register, so we must pass last LMUL 8 vector argument by stack.

However LLVM only reserve 8 byte on stack for the LMUL 8 vector
argument, it will cause stack corruption when we try to store that into
stack.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D145934




More information about the All-commits mailing list