[clang] [Clang] Add fake use emission to Clang with -fextend-lifetimes (PR #110102)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 3 10:19:07 PST 2024
================
@@ -1353,6 +1353,19 @@ void CodeGenFunction::EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr) {
C->setDoesNotThrow();
}
+void CodeGenFunction::EmitFakeUse(Address Addr) {
+ // We do not emit a fake use if we want to apply optnone to this function,
+ // even if we might not apply it anyway due to minsize or similar attributes.
+ if (!CGM.getCodeGenOpts().DisableO0ImplyOptNone &&
+ CGM.getCodeGenOpts().OptimizationLevel == 0)
+ return;
----------------
dwblaikie wrote:
(FWIW - clang IRGen always emit stack-home locations, at any optimization level - it's only a question of whether we run the optimizations (& whether they fire, eg: we might run the optimization pass, but it detects a function is optnone, then it does nothing) that remove those stack homes)
https://github.com/llvm/llvm-project/pull/110102
More information about the cfe-commits
mailing list