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

Paul Kirth via All-commits all-commits at lists.llvm.org
Thu Dec 4 13:48:47 PST 2025


  Branch: refs/heads/users/ilovepi/clang-lifetimes-2
  Home:   https://github.com/llvm/llvm-project
  Commit: acdccf174bad71ff21f820660528bcd460bb1f37
      https://github.com/llvm/llvm-project/commit/acdccf174bad71ff21f820660528bcd460bb1f37
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-04 (Thu, 04 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: 463c2d1abcb9649aa2e78183bd5c670aab770adb
      https://github.com/llvm/llvm-project/commit/463c2d1abcb9649aa2e78183bd5c670aab770adb
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-04 (Thu, 04 Dec 2025)

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

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


  Commit: 8799240074b7876f1e689d7551a7049b5578d864
      https://github.com/llvm/llvm-project/commit/8799240074b7876f1e689d7551a7049b5578d864
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-04 (Thu, 04 Dec 2025)

  Changed paths:
    M clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp

  Log Message:
  -----------
  Update invoke test for tighter lifetimes


  Commit: 21b9837571a03a24a3185cafbb7c81d18d475916
      https://github.com/llvm/llvm-project/commit/21b9837571a03a24a3185cafbb7c81d18d475916
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-04 (Thu, 04 Dec 2025)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/test/CodeGen/lifetime-invoke-c.c
    M clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp

  Log Message:
  -----------
  Add cleanups for the error path and add more tests


Compare: https://github.com/llvm/llvm-project/compare/ba5d29ead0e0...21b9837571a0

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