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

Paul Kirth via All-commits all-commits at lists.llvm.org
Fri Dec 5 10:50:50 PST 2025


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

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGCall.h
    A 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: 89d68ad1d4e9b10a10a9356a75d30d6a4ac83133
      https://github.com/llvm/llvm-project/commit/89d68ad1d4e9b10a10a9356a75d30d6a4ac83133
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-05 (Fri, 05 Dec 2025)

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

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


  Commit: 1a5a09aacd90d2cd274aee01f63094f836e3ee60
      https://github.com/llvm/llvm-project/commit/1a5a09aacd90d2cd274aee01f63094f836e3ee60
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-05 (Fri, 05 Dec 2025)

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

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


  Commit: 8d4514a664492220dda1aaee41b47a1a606cb99d
      https://github.com/llvm/llvm-project/commit/8d4514a664492220dda1aaee41b47a1a606cb99d
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-05 (Fri, 05 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


  Commit: d43b2b26fec60d27fe6848302222dc73bd3a793d
      https://github.com/llvm/llvm-project/commit/d43b2b26fec60d27fe6848302222dc73bd3a793d
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-05 (Fri, 05 Dec 2025)

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

  Log Message:
  -----------
  Avoid checking NoLifetimeMarkersForTemporaries


  Commit: 1b4fb8bc2c4a10d35520a425a6a341c2c2a82687
      https://github.com/llvm/llvm-project/commit/1b4fb8bc2c4a10d35520a425a6a341c2c2a82687
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2025-12-05 (Fri, 05 Dec 2025)

  Changed paths:
    M clang/test/CodeGen/lifetime-invoke-c.c

  Log Message:
  -----------
  Fix test checks


Compare: https://github.com/llvm/llvm-project/compare/3dc61c195377...1b4fb8bc2c4a

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