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

Eli Friedman via All-commits all-commits at lists.llvm.org
Mon Sep 9 23:16:20 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 8664666823b3eb8d96fde58f79d71d36bd7f9115
      https://github.com/llvm/llvm-project/commit/8664666823b3eb8d96fde58f79d71d36bd7f9115
  Author: Eli Friedman <efriedma at quicinc.com>
  Date:   2024-09-10 (Tue, 10 Sep 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.

(cherry picked from commit 1762e01cca0186f1862db561cfd9019164b8c654)



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