[llvm] [FuncAttrs] Relax norecurse attribute inference (PR #139943)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 04:18:45 PDT 2025


================
@@ -2071,24 +2072,36 @@ static void addNoRecurseAttrs(const SCCNodeSet &SCCNodes,
   if (!F || !F->hasExactDefinition() || F->doesNotRecurse())
     return;
 
-  // If all of the calls in F are identifiable and are to norecurse functions, F
-  // is norecurse. This check also detects self-recursion as F is not currently
-  // marked norecurse, so any called from F to F will not be marked norecurse.
-  for (auto &BB : *F)
-    for (auto &I : BB.instructionsWithoutDebug())
+  if (F->hasAddressTaken())
----------------
david-arm wrote:

Ah yes, you're right! Apologies for the noise. I had forgotten about the `if (SCCNodes.size() != 1)` check at the top of the function. I guess you  can remove the `LazyCallGraph &CG` argument now?

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


More information about the llvm-commits mailing list