[clang] [Clang] Add fake use emission to Clang with -fextend-lifetimes (PR #110102)
Paul T Robinson via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 4 06:25:04 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;
----------------
pogo59 wrote:
Objection withdrawn. Because it's opt-in, we should do what the user requested. As you say, in a normal `-O0` situation all this does is increase IR size for no benefit, but it has its uses.
https://github.com/llvm/llvm-project/pull/110102
More information about the cfe-commits
mailing list