[PATCH] D103622: [RISCV] Avoid scalar outgoing arguments overwrite vector frame objects.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 9 18:34:42 PDT 2021


HsiangKai added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/rvv/rvv-out-arguments.ll:88
-; CHECK-NEXT:    addi a0, a0, -128
+; CHECK-NEXT:    addi a0, a0, -112
 ; CHECK-NEXT:    vs8r.v v8, (a0)
 ; CHECK-NEXT:    addi a0, zero, 1
----------------
frasercrmck wrote:
> Just so I understand, this is presumably the bug here, right? We're storing a vector register to `a0` which is `s0 - (vlenb<<3) - 128` which is (in a roundabout way) `sp`? And we store the arguments to the same spots `0(sp)` and `8(sp)` on lines 116 and 115?
Yeah, that is the problem. Out going arguments overwrite the vector value here. When users call the function, `lots_args`, second time, the vector value will be loaded from stack under `-O0`. Users will get the wrong value in the second call.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103622



More information about the llvm-commits mailing list