[all-commits] [llvm/llvm-project] e3c57f: [clang][RISCV] Fix bug in ABI handling of empty st...

Alex Bradbury via All-commits all-commits at lists.llvm.org
Mon Aug 7 02:45:59 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3c57fdd8439ba82c67347629a3c66f293e1f3d0
      https://github.com/llvm/llvm-project/commit/e3c57fdd8439ba82c67347629a3c66f293e1f3d0
  Author: Alex Bradbury <asb at igalia.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/CodeGen/ABIInfoImpl.cpp
    M clang/lib/CodeGen/ABIInfoImpl.h
    M clang/lib/CodeGen/Targets/RISCV.cpp
    M clang/test/CodeGen/RISCV/abi-empty-structs.c

  Log Message:
  -----------
  [clang][RISCV] Fix bug in ABI handling of empty structs with hard FP calling conventions in C++

As reported in <https://github.com/llvm/llvm-project/issues/58929>,
Clang's handling of empty structs in the case of small structs that may
be eligible to be passed using the hard FP calling convention doesn't
match g++. In general, C++ record fields are never empty unless
[[no_unique_address]] is used, but the RISC-V FP ABI overrides this.

After this patch, fields of structs that contain empty records will be
ignored, even in C++, when considering eligibility for the FP calling
convention ('flattening'). It isn't explicitly noted in the RISC-V
psABI, but arrays of empty records will disqualify a struct for
consideration of using the FP calling convention in g++. This patch
matches that behaviour. The psABI issue
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/358> seeks
to clarify this.

This patch was previously committed but reverted after a bug was found.
This recommit adds additional logic to prevent that bug (adding an extra
check for when a candidate from detectFPCCEligibleStructHelper may not
be valid).

Differential Revision: https://reviews.llvm.org/D142327




More information about the All-commits mailing list