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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 08:34:27 PDT 2025


================
@@ -2322,8 +2352,29 @@ PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
     Functions.push_back(&N.getFunction());
   }
 
+  bool AnyFunctionsAddressIsTaken = false;
+  // Check if any function in the whole program has its address taken.
+  // We use this information when inferring norecurse attribute: If there is
+  // no function whose address is taken, we conclude that any external function
+  // cannot callback into any user function.
----------------
nikic wrote:

Being in LTO post-link does *not* imply that you have whole program visibility. To give a simple example, you could be linking a dylib. LTO post-link is still subject to an export list. Only the symbols which have been internalized are internal.

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


More information about the llvm-commits mailing list