[all-commits] [llvm/llvm-project] 1762e0: Fix codegen of consteval functions returning an em...

Eli Friedman via All-commits all-commits at lists.llvm.org
Thu Aug 1 16:18:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1762e01cca0186f1862db561cfd9019164b8c654
      https://github.com/llvm/llvm-project/commit/1762e01cca0186f1862db561cfd9019164b8c654
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2024-08-01 (Thu, 01 Aug 2024)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/test/CodeGen/arm-mve-intrinsics/vld24.c
    M clang/test/CodeGen/arm-vfp16-arguments2.cpp
    M clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
    M clang/test/CodeGenCUDA/builtins-amdgcn.cu
    M clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu
    M clang/test/CodeGenCXX/address-space-cast-coerce.cpp
    M clang/test/CodeGenCXX/cxx2a-consteval.cpp
    M clang/test/CodeGenCXX/trivial_abi.cpp
    M clang/test/CodeGenHIP/dpp-const-fold.hip
    M clang/test/CodeGenHIP/spirv-amdgcn-dpp-const-fold.hip
    M clang/test/CodeGenOpenCL/addr-space-struct-arg.cl
    M clang/test/CodeGenOpenCL/amdgpu-abi-struct-arg-byref.cl

  Log Message:
  -----------
  Fix codegen of consteval functions returning an empty class, and related issues (#93115)

Fix codegen of consteval functions returning an empty class, and related
issues

If a class is empty, don't store it to memory: the store might overwrite
useful data. Similarly, if a class has tail padding that might overlap
other fields, don't store the tail padding to memory.

The problem here turned out a bit more general than I initially thought:
basically all uses of EmitAggregateStore were broken. Call lowering had
a method that did mostly the right thing, though: CreateCoercedStore.
Adapt CreateCoercedStore so it always does the conservatively right
thing, and use it for both calls and ConstantExpr.

Also, along the way, fix the "overlap" bit in AggValueSlot: the bit was
set incorrectly for empty classes in some cases.

Fixes #93040.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list