[llvm] [FuncAttrs] Relax norecurse attribute inference (PR #139943)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 30 07:52:38 PDT 2025
================
@@ -2322,8 +2343,39 @@ PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
Functions.push_back(&N.getFunction());
}
- auto ChangedFunctions =
- deriveAttrsInPostOrder(Functions, AARGetter, ArgAttrsOnly);
+ bool NoFunctionsAddressIsTaken = false;
+ // Check if any function in the whole program has its address taken or has
+ // potentially external linkage.
+ // We use this information when inferring norecurse attribute: If there is
+ // no function whose address is taken and all functions have internal
+ // linkage, there is no path for a callback to any user function.
+ if (IsLTOPostLink || ForceLTOFuncAttrs) {
----------------
nikic wrote:
Do I understand correctly that the IsLTOPostLink check here is not actually needed for correctness?
https://github.com/llvm/llvm-project/pull/139943
More information about the llvm-commits
mailing list