[clang] [Clang][CodeGen] Emit fake uses before musttail calls (PR #136867)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 25 00:08:45 PDT 2025
================
@@ -6001,8 +6001,18 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
for (auto it = EHStack.find(CurrentCleanupScopeDepth); it != EHStack.end();
++it) {
EHCleanupScope *Cleanup = dyn_cast<EHCleanupScope>(&*it);
- if (!(Cleanup && Cleanup->getCleanup()->isRedundantBeforeReturn()))
+ // Fake uses can be safely emitted immediately prior to the tail call; we
+ // choose to emit the fake use before the call rather than after, to avoid
+ // forcing variable values from every call on the "stack" to be preserved
+ // simultaneously.
----------------
rjmccall wrote:
The second half of this comment is odd. There isn't really a choice about this; the fake uses must be emitted prior to the tail call because there cannot be anything after it.
https://github.com/llvm/llvm-project/pull/136867
More information about the cfe-commits
mailing list