[RISCV] Add a test showing incorrect codegen
authorFraser Cormack <fraser@codeplay.com>
Wed, 20 Jan 2021 07:49:53 +0000 (07:49 +0000)
committerFraser Cormack <fraser@codeplay.com>
Mon, 5 Apr 2021 10:51:03 +0000 (11:51 +0100)
commit0d0514dd9b81bdf7a2ba5f5ef1d36d6e96201a0b
treed5180f59fef88d996423069f8df81803c24dffb8
parent36d4f6d7f8ad08bb99da544f2b6ca96e34977839
[RISCV] Add a test showing incorrect codegen

This patch adds a test which shows how the compiler incorrectly sets the
size and alignment of a stack object used to indirectly pass vector
types to functions.

In the particular example, the test passes a <4 x i8> vector type to a
function and creates a stack object of size and alignment equal to 4
bytes. However, the code generated to set up that parameter has been
scalarized and stores each element as individual XLEN-sized values. Thus
on RV32 this stores 16 bytes and on RV64 32 bytes, both of which clobber
the stack. Similarly, the alignment is set up as the alignment
of the vector type, which is not necessarily the natural alignment of XLEN.

Reviewed By: luismarques

Differential Revision: https://reviews.llvm.org/D95025
llvm/test/CodeGen/RISCV/vector-abi.ll [new file with mode: 0644]