[all-commits] [llvm/llvm-project] 9e0c06: [clang][CodeGen] Set `dead_on_return` when passing...

Antonio Frighetto via All-commits all-commits at lists.llvm.org
Fri Jul 18 02:53:24 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e0c06d708a40bb3c8bd08acd982836cce718135
      https://github.com/llvm/llvm-project/commit/9e0c06d708a40bb3c8bd08acd982836cce718135
  Author: Antonio Frighetto <me at antoniofrighetto.com>
  Date:   2025-07-18 (Fri, 18 Jul 2025)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/test/CodeGen/64bit-swiftcall.c
    M clang/test/CodeGen/AArch64/byval-temp.c
    M clang/test/CodeGen/AArch64/pure-scalable-args-empty-union.c
    M clang/test/CodeGen/AArch64/pure-scalable-args.c
    M clang/test/CodeGen/AArch64/struct-coerce-using-ptr.cpp
    M clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c
    M clang/test/CodeGen/AArch64/sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.cpp
    M clang/test/CodeGen/LoongArch/bitint.c
    M clang/test/CodeGen/PowerPC/ppc64-vector.c
    M clang/test/CodeGen/RISCV/riscv-abi.cpp
    M clang/test/CodeGen/RISCV/riscv-vector-callingconv-llvm-ir.c
    M clang/test/CodeGen/RISCV/riscv-vector-callingconv-llvm-ir.cpp
    M clang/test/CodeGen/RISCV/riscv32-abi.c
    M clang/test/CodeGen/RISCV/riscv32-vararg.c
    M clang/test/CodeGen/RISCV/riscv64-abi.c
    M clang/test/CodeGen/RISCV/riscv64-vararg.c
    M clang/test/CodeGen/SystemZ/systemz-abi-vector.c
    M clang/test/CodeGen/SystemZ/systemz-abi.c
    M clang/test/CodeGen/SystemZ/systemz-inline-asm.c
    M clang/test/CodeGen/X86/cx-complex-range.c
    M clang/test/CodeGen/X86/x86_32-arguments-win32.c
    M clang/test/CodeGen/X86/x86_64-arguments-win32.c
    M clang/test/CodeGen/aapcs64-align.cpp
    M clang/test/CodeGen/arm-aapcs-vfp.c
    M clang/test/CodeGen/arm-abi-vector.c
    M clang/test/CodeGen/arm-swiftcall.c
    M clang/test/CodeGen/arm64-abi-vector.c
    M clang/test/CodeGen/arm64-arguments.c
    M clang/test/CodeGen/arm64-microsoft-arguments.cpp
    M clang/test/CodeGen/armv7k-abi.c
    M clang/test/CodeGen/atomic-arm64.c
    M clang/test/CodeGen/attr-noundef.cpp
    M clang/test/CodeGen/cx-complex-range.c
    M clang/test/CodeGen/ext-int-cc.c
    M clang/test/CodeGen/isfpclass.c
    M clang/test/CodeGen/math-libcalls-tbaa-indirect-args.c
    M clang/test/CodeGen/mingw-long-double.c
    M clang/test/CodeGen/ms_abi.c
    M clang/test/CodeGen/pass-by-value-noalias.c
    M clang/test/CodeGen/ptrauth-in-c-struct.c
    M clang/test/CodeGen/regcall.c
    M clang/test/CodeGen/regcall2.c
    M clang/test/CodeGen/regcall4.c
    M clang/test/CodeGen/sparcv9-abi.c
    M clang/test/CodeGen/vectorcall.c
    M clang/test/CodeGen/win-fp128.c
    M clang/test/CodeGen/win64-i128.c
    M clang/test/CodeGen/windows-swiftcall.c
    M clang/test/CodeGenCXX/aarch64-mangle-sve-vectors.cpp
    M clang/test/CodeGenCXX/arm-cc.cpp
    M clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp
    M clang/test/CodeGenCXX/copy-initialization.cpp
    M clang/test/CodeGenCXX/debug-info.cpp
    M clang/test/CodeGenCXX/empty-nontrivially-copyable.cpp
    M clang/test/CodeGenCXX/fastcall.cpp
    M clang/test/CodeGenCXX/homogeneous-aggregates.cpp
    M clang/test/CodeGenCXX/inalloca-lambda.cpp
    M clang/test/CodeGenCXX/inalloca-overaligned.cpp
    M clang/test/CodeGenCXX/inalloca-vector.cpp
    M clang/test/CodeGenCXX/inheriting-constructor.cpp
    M clang/test/CodeGenCXX/member-function-pointer-calls.cpp
    M clang/test/CodeGenCXX/microsoft-abi-arg-order.cpp
    M clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
    M clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp
    M clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp
    M clang/test/CodeGenCXX/microsoft-abi-unknown-arch.cpp
    M clang/test/CodeGenCXX/ms-property.cpp
    M clang/test/CodeGenCXX/nrvo.cpp
    M clang/test/CodeGenCXX/pass-by-value-noalias.cpp
    M clang/test/CodeGenCXX/ptrauth-qualifier-struct.cpp
    M clang/test/CodeGenCXX/regparm.cpp
    M clang/test/CodeGenCXX/trivial_abi.cpp
    M clang/test/CodeGenCXX/uncopyable-args.cpp
    M clang/test/CodeGenCXX/wasm-args-returns.cpp
    M clang/test/CodeGenCXX/windows-x86-swiftcall.cpp
    M clang/test/CodeGenObjC/nontrivial-c-struct-exception.m
    M clang/test/CodeGenObjC/pass-by-value-noalias.m
    M clang/test/CodeGenObjC/weak-in-c-struct.m
    M clang/test/CodeGenObjCXX/objc-struct-cxx-abi.mm
    M clang/test/CodeGenObjCXX/property-objects.mm
    M clang/test/CodeGenObjCXX/ptrauth-struct-cxx-abi.mm
    M clang/test/Headers/stdarg.cpp
    M clang/test/OpenMP/for_firstprivate_codegen.cpp
    M clang/test/OpenMP/parallel_firstprivate_codegen.cpp
    M clang/test/OpenMP/sections_firstprivate_codegen.cpp
    M clang/test/OpenMP/single_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_firstprivate_codegen.cpp

  Log Message:
  -----------
  [clang][CodeGen] Set `dead_on_return` when passing arguments indirectly

Let Clang emit `dead_on_return` attribute on pointer arguments
that are passed indirectly, namely, large aggregates that the
ABI mandates be passed by value; thus, the parameter is destroyed
within the callee. Writes to such arguments are not observable by
the caller after the callee returns.

This should desirably enable further MemCpyOpt/DSE optimizations.

Previous discussion: https://discourse.llvm.org/t/rfc-add-dead-on-return-attribute/86871.



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