[all-commits] [llvm/llvm-project] 1cccdf: [clang] Introduce scopes for arguments without des...

Paul Kirth via All-commits all-commits at lists.llvm.org
Wed Apr 8 10:51:04 PDT 2026


  Branch: refs/heads/users/ilovepi/clang-c-lifetimes
  Home:   https://github.com/llvm/llvm-project
  Commit: 1cccdf78f4602775bc6cc2f45ece6edb5f06db2d
      https://github.com/llvm/llvm-project/commit/1cccdf78f4602775bc6cc2f45ece6edb5f06db2d
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2026-04-08 (Wed, 08 Apr 2026)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/test/CodeGen/lifetime-bug-2.cpp
    M clang/test/CodeGen/lifetime-bug.cpp
    M clang/test/CodeGen/lifetime-invoke-c.c
    A clang/test/CodeGen/stack-usage-lifetimes.c
    M clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
    M clang/test/CodeGenCoroutines/pr59181.cpp

  Log Message:
  -----------
  [clang] Introduce scopes for arguments without destructors

The current way we mark argument lifetimes is overly conservative for
most programs. To improve the status quo, we can introduce a new scope
for the arguments when it is safe to do so. This applies to aggregate
types that do not have destructors, and Objective-C types that are not
managed by reference counting (ARC). These rules may be possible to
refine more, but this recaptures a significant amount of the cases where
temporary objects never have their storage reused in stack coloring.

Note: I used an LLM to help draft test changes and suggest the scoping
rules for Objective-C.



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