[all-commits] [llvm/llvm-project] 9ca6bf: [LoongArch] Fix ABI mismatch with gcc/g++ about em...

Lu Weining via All-commits all-commits at lists.llvm.org
Tue Oct 31 06:18:20 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ca6bf3fb7b7df373723b3275730f101f9ff816b
      https://github.com/llvm/llvm-project/commit/9ca6bf3fb7b7df373723b3275730f101f9ff816b
  Author: Lu Weining <luweining at loongson.cn>
  Date:   2023-10-31 (Tue, 31 Oct 2023)

  Changed paths:
    M clang/lib/CodeGen/Targets/LoongArch.cpp
    M clang/test/CodeGen/LoongArch/abi-lp64d-empty-structs.c

  Log Message:
  -----------
  [LoongArch] Fix ABI mismatch with gcc/g++ about empty structs passing (#70320)

How empty structs (not as fields of container struct) are passed in C++
is not explicitly documented in psABI. However, this patch fixes the
mismatch with g++.

Note that the unnamed bitfield case `struct { int : 1; }` in C is also
fixed. Previously clang regards it as an empty struct and then ignores
it when passing. Now size of the struct is counted; since it's size is
not 0, clang will not ignore it even in C.

While https://reviews.llvm.org/D156116 fixed the handling of empty
struct when considering eligibility of the container struct for the FP
calling convention ('flattening'), this patch fixes the handling of
passing the empty struct itself.

Fix https://github.com/llvm/llvm-project/issues/70319




More information about the All-commits mailing list