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

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


  Branch: refs/heads/users/ilovepi/clang-lifetimes-2
  Home:   https://github.com/llvm/llvm-project
  Commit: 448fa8e34242c407915a2f1b7221a6fc0b3ecf07
      https://github.com/llvm/llvm-project/commit/448fa8e34242c407915a2f1b7221a6fc0b3ecf07
  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.


  Commit: 64b91cbc8d1f5b0d4f3e7d9c00613d28d1777845
      https://github.com/llvm/llvm-project/commit/64b91cbc8d1f5b0d4f3e7d9c00613d28d1777845
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-03 (Wed, 03 Dec 2025)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp

  Log Message:
  -----------
  Update comment to be more accurate


Compare: https://github.com/llvm/llvm-project/compare/231df8a33e49...64b91cbc8d1f

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