[RISCV] Scale scalably-typed split argument offsets by VSCALE
authorFraser Cormack <fraser@codeplay.com>
Thu, 27 May 2021 15:47:36 +0000 (16:47 +0100)
committerFraser Cormack <fraser@codeplay.com>
Mon, 31 May 2021 09:43:13 +0000 (10:43 +0100)
commit2b37c405cc18019ea5056a63fa65f839a4890b50
tree1fb18ce915c8034cf02afd302d3dccad30fffa4c
parent7161bb87c914684562bfb20fec7d60e533150f7a
[RISCV] Scale scalably-typed split argument offsets by VSCALE

This patch fixes a bug in lowering scalable-vector types in RISC-V's
main calling convention. When scalable-vector types are split and passed
indirectly, the target is responsible for scaling the offset --
initially set to the known-minimum store size -- by the scalable factor.

Before this we were issuing overlapping loads or stores to the different
parts, leading to incorrect codegen.

Credit to @HsiangKai for spotting this.

Reviewed By: HsiangKai

Differential Revision: https://reviews.llvm.org/D103262
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/calling-conv.ll