[llvm] [profcheck] Exclude `naked`, asm-only functions from profcheck (PR #168447)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 08:25:53 PST 2025


================
@@ -65,11 +65,26 @@ class ProfileInjector {
   ProfileInjector(Function &F, FunctionAnalysisManager &FAM) : F(F), FAM(FAM) {}
   bool inject();
 };
+
+bool isAsmOnly(const Function &F) {
+  if (!F.hasFnAttribute(Attribute::AttrKind::Naked))
+    return false;
+  for (const auto &BB : F)
----------------
mtrofin wrote:

I thought so too initially, but then (1) read https://llvm.org/docs/LangRef.html which just says

```
This attribute disables prologue / epilogue emission for the function. This can have very system-specific consequences. The arguments of a naked function can not be referenced through IR values.
```

...which is more permissive; and (2) couldn't find any check in `Verifier.cpp` that's more than

```
  if (Attrs.hasFnAttr(Attribute::Naked))
    for (const Argument &Arg : F.args())
      Check(Arg.use_empty(), "cannot use argument of naked function", &Arg);
```

Maybe there was a subsequent discussion but no doc/verifier update? (Happy to do those separately)

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


More information about the llvm-commits mailing list