[clang] [lld] [llvm] [LLVM] Respect `optnone` in `promote-args` and `deadargelim` (PR #211804)

Antonio Frighetto via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 6 07:01:25 PDT 2026


================
@@ -405,6 +405,13 @@ bool GlobalValue::isNoipaFnDef() const {
   return F->hasFnAttribute(Attribute::NoIPA);
 }
 
+bool GlobalValue::isOptNoneFnDef() const {
+  const Function *F = dyn_cast<Function>(this);
+  if (!F || F->isDeclaration())
+    return false;
+  return F->hasFnAttribute(Attribute::OptimizeNone);
----------------
antoniofrighetto wrote:

Nit, but not strong:
```suggestion
  const auto *F = dyn_cast<Function>(this);
  return F && !F->isDeclaration() && F->hasFnAttribute(Attribute::OptimizeNone);
```

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


More information about the cfe-commits mailing list