[PATCH] D159500: Reapply x2: [IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 10:50:57 PDT 2023


nickdesaulniers created this revision.
Herald added a subscriber: jvesely.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This reverts commit b7f4915644844fb9f32e8763922a070f5fe4fd29 <https://reviews.llvm.org/rGb7f4915644844fb9f32e8763922a070f5fe4fd29>.

These temporaries are only used in the callee, and their memory can be
reused after the call is complete.

rdar://58552124

Original Author: Erik Pilkington <erik.pilkington at gmail.com>

The second time this landed, it had a bug where the lifetimes of
references to the temporaries was cut short prematurely. For now, skip
emitting the lifetime annotations if the callee returns a reference.  We
can probably do better than this.

Link: https://github.com/llvm/llvm-project/issues/38157
Link: https://github.com/llvm/llvm-project/issues/41896
Link: https://github.com/llvm/llvm-project/issues/43598
Link: https://github.com/ClangBuiltLinux/linux/issues/39
Link: https://reviews.llvm.org/rGfafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159500

Files:
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGCall.h
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/lifetime-call-temp.c
  clang/test/CodeGenCXX/amdgcn-call-with-aggarg.cpp
  clang/test/CodeGenCXX/stack-reuse-miscompile.cpp
  clang/test/CodeGenCoroutines/pr59181.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159500.556460.patch
Type: text/x-patch
Size: 12463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230911/39e13efe/attachment-0001.bin>


More information about the cfe-commits mailing list