[all-commits] [llvm/llvm-project] 0d0514: [RISCV] Add a test showing incorrect codegen

Fraser Cormack via All-commits all-commits at lists.llvm.org
Mon Apr 5 03:58:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0d0514dd9b81bdf7a2ba5f5ef1d36d6e96201a0b
      https://github.com/llvm/llvm-project/commit/0d0514dd9b81bdf7a2ba5f5ef1d36d6e96201a0b
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2021-04-05 (Mon, 05 Apr 2021)

  Changed paths:
    A llvm/test/CodeGen/RISCV/vector-abi.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list