diff options
author | Wolfgang Pieb <wolfgang.pieb@sony.com> | 2024-09-25 16:55:39 +0100 |
---|---|---|
committer | Stephen Tozer <Stephen.Tozer@sony.com> | 2025-01-28 12:30:31 +0000 |
commit | 4424c44c8c4ec8e071f5c5999fba216d36fb92c9 (patch) | |
tree | bf43c91b05431d770e363a25875a2da33b9791b4 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 500a1834d92d701fea914ab5de10d82d6c90dbd9 (diff) | |
download | llvm-4424c44c8c4ec8e071f5c5999fba216d36fb92c9.zip llvm-4424c44c8c4ec8e071f5c5999fba216d36fb92c9.tar.gz llvm-4424c44c8c4ec8e071f5c5999fba216d36fb92c9.tar.bz2 |
[Clang] Add fake use emission to Clang with -fextend-lifetimes (#110102)
Following the previous patch which adds the "extend lifetimes" flag
without (almost) any functionality, this patch adds the real feature by
allowing Clang to emit fake uses. These are emitted as a new form of cleanup,
set for variable addresses, which just emits a fake use intrinsic when the
variable falls out of scope. The code for achieving this is simple, with most
of the logic centered on determining whether to emit a fake use for a given
address, and on ensuring that fake uses are ignored in a few cases.
Co-authored-by: Stephen Tozer <stephen.tozer@sony.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 11fdddb..bbef277 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -404,9 +404,9 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // important to do this before we enter the return block or return // edges will be *really* confused. bool HasCleanups = EHStack.stable_begin() != PrologueCleanupDepth; - bool HasOnlyLifetimeMarkers = - HasCleanups && EHStack.containsOnlyLifetimeMarkers(PrologueCleanupDepth); - bool EmitRetDbgLoc = !HasCleanups || HasOnlyLifetimeMarkers; + bool HasOnlyNoopCleanups = + HasCleanups && EHStack.containsOnlyNoopCleanups(PrologueCleanupDepth); + bool EmitRetDbgLoc = !HasCleanups || HasOnlyNoopCleanups; std::optional<ApplyDebugLocation> OAL; if (HasCleanups) { |