[all-commits] [llvm/llvm-project] 8c5c2c: [clang][CodeGen] Exempt lifetime marker cleanups i...
Nick Desaulniers via All-commits
all-commits at lists.llvm.org
Mon Sep 21 10:30:26 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8c5c2ccf47434b4c948e5b875c977bef4d15c84e
https://github.com/llvm/llvm-project/commit/8c5c2ccf47434b4c948e5b875c977bef4d15c84e
Author: Nick Desaulniers <ndesaulniers at google.com>
Date: 2026-09-21 (Mon, 21 Sep 2026)
Changed paths:
M clang/lib/CodeGen/CGCall.cpp
M clang/lib/CodeGen/CGCleanup.cpp
M clang/lib/CodeGen/CGCleanup.h
M clang/lib/CodeGen/CGDecl.cpp
M clang/lib/CodeGen/CodeGenFunction.h
M clang/lib/CodeGen/EHScopeStack.h
M clang/test/CodeGen/compound-literal-lifetime.c
Log Message:
-----------
[clang][CodeGen] Exempt lifetime marker cleanups in musttail check (#224731)
PR #219045 started emitting @llvm.lifetime.start and @llvm.lifetime.end
markers for block-scoped compound literals in C via
pushCleanupAfterFullExpr<CallLifetimeEnd>.
When a compound literal is evaluated inside a conditional branch,
pushCleanupAfterFullExpr wraps CallLifetimeEnd inside
EHScopeStack::ConditionalCleanup, which did not override
EHScopeStack::Cleanup::isRedundantBeforeReturn(). Consequently,
CodeGenFunction::EmitCall rejected [[clang::musttail]] calls when a
conditional compound literal was in scope at -O1 and above.
Because EHScopeStack::ConditionalCleanup wraps cleanups by composition,
virtual methods on EHScopeStack::Cleanup other than Emit() do not work
for conditional cleanups. Replace the virtual
EHScopeStack::Cleanup::isRedundantBeforeReturn() method with a
StackRestore bit on CleanupKind/EHCleanupScope alongside the existing
LifetimeMarker bit, and check EHCleanupScope::isRedundantBeforeReturn()
in CodeGenFunction::EmitCall.
Assisted-by: Gemini
Fixes: 93b2629d1d1f ("[clang][CodeGen] Emit lifetime markers for
block-scoped compound literals in C (#219045)")
Fixes: https://github.com/llvm/llvm-project/issues/224337
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