[RISCV] Add a test w/ RVV stack objects misaligning non-RVV ones
authorFraser Cormack <fraser@codeplay.com>
Wed, 11 May 2022 13:08:41 +0000 (14:08 +0100)
committerFraser Cormack <fraser@codeplay.com>
Tue, 17 May 2022 07:49:08 +0000 (08:49 +0100)
commit821522d343cd127312fb07b53aa99e22b3aacc0c
tree8370c304412ea46cb40f6e1004b4c492631f4776
parent599ff247dee8f462638731c3b2fdd3d1e332a2fe
[RISCV] Add a test w/ RVV stack objects misaligning non-RVV ones

This patch adds a simple test which demonstrates a miscompilation of
16-byte-aligned scalar (non-RVV) objects when combined with RVV stack
objects.

The RISCV stack is assumed to be aligned to 16 bytes, and this is
guaranteed/assumed to be true when setting up the stack. However, when
the stack contains RVV objects, we decrement the stack pointer by some
multiple of vlenb, which is only guaranteed to be aligned to 8 bytes.
This means that non-RVV objects specifically requiring 16-byte alignment
fall through the cracks and are misaligned. Objects requiring larger
alignment trigger stack realignment and thus should be okay.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D125382
llvm/test/CodeGen/RISCV/rvv/scalar-stack-align.ll [new file with mode: 0644]