[all-commits] [llvm/llvm-project] 231df8: [clang] Use tighter lifetime bounds for C temporar...

Paul Kirth via All-commits all-commits at lists.llvm.org
Wed Dec 3 13:57:12 PST 2025


  Branch: refs/heads/users/ilovepi/clang-lifetimes-2
  Home:   https://github.com/llvm/llvm-project
  Commit: 231df8a33e4972fa7bee4a8013face534b3f58fc
      https://github.com/llvm/llvm-project/commit/231df8a33e4972fa7bee4a8013face534b3f58fc
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-03 (Wed, 03 Dec 2025)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGCall.h
    M clang/test/CodeGen/stack-usage-lifetimes.c
    M clang/test/CodeGenCXX/stack-reuse-miscompile.cpp

  Log Message:
  -----------
  [clang] Use tighter lifetime bounds for C temporary arguments

In C, consecutive statements in the same scope are under
CompoundStmt/CallExpr, while in C++ they typically fall under
CompoundStmt/ExprWithCleanup. This leads to different behavior with
respect to where pushFullExprCleanUp inserts the lifetime end markers
(e.g., at the end of scope).

For these cases, we can track and insert the lifetime end markers right
after the call completes. Allowing the stack space to be reused
immediately. This partially addresses #109204 and #43598 for improving
stack usage.



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