[clang] [ExtendLifetimes] Add extend lifetimes to emit fake uses from clang (PR #106724)

Paul T Robinson via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 09:32:43 PDT 2024


================
@@ -2523,6 +2575,15 @@ llvm::Function *CodeGenModule::getLLVMLifetimeEndFn() {
   return LifetimeEndFn;
 }
 
+/// Lazily declare the @llvm.fake.use intrinsic.
+llvm::Function *CodeGenModule::getLLVMFakeUseFn() {
+  if (FakeUseFn)
+    return FakeUseFn;
+  FakeUseFn =
+      llvm::Intrinsic::getDeclaration(&getModule(), llvm::Intrinsic::fake_use);
+  return FakeUseFn;
----------------
pogo59 wrote:

```suggestion
  if (!FakeUseFn)
    FakeUseFn =
        llvm::Intrinsic::getDeclaration(&getModule(), llvm::Intrinsic::fake_use);
  return FakeUseFn;
```
This seems a bit simpler to read, but I'm not insisting.

https://github.com/llvm/llvm-project/pull/106724


More information about the cfe-commits mailing list