[all-commits] [llvm/llvm-project] bc5383: [clang][RISCV] Fix incorrect ABI lowering for inhe...

Alex Bradbury via All-commits all-commits at lists.llvm.org
Fri Aug 19 12:32:31 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bc538320809fb52af12ec0366118c82201af4f40
  Author: Alex Bradbury <asb at igalia.com>
  Date:   2022-08-19 (Fri, 19 Aug 2022)

  Changed paths:
    M clang/lib/CodeGen/TargetInfo.cpp
    M clang/test/CodeGen/RISCV/riscv-abi.cpp

  Log Message:
  [clang][RISCV] Fix incorrect ABI lowering for inherited structs under hard-float ABIs

The hard float ABIs have a rule that if a flattened struct contains
either a single fp value, or an int+fp, or fp+fp then it may be passed
in a pair of registers (if sufficient GPRs+FPRs are available).
detectFPCCEligibleStruct and the helper it calls,
detectFPCCEligibleStructHelper examine the type of the argument/return
value to determine if it complies with the requirements for this ABI

As reported in bug #57084, this logic produces incorrect results for C++
structs that inherit from other structs. This is because only the fields
of the struct were examined, but enumerating RD->fields misses any
fields in inherited C++ structs. This patch corrects that issue by
adding appropriate logic to enumerate any included base structs.

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

More information about the All-commits mailing list