[llvm] [FuncAttrs] Relax norecurse attribute inference (PR #139943)
Usha Gupta via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 11 11:06:03 PDT 2025
usha1830 wrote:
@david-arm @nikic
I've updated the condition checks for callees to better handle unknown external calls.
Specifically, to account for the possibility that an external function may call back into the current function, the logic now checks whether the **address of any function in the program is taken**. If so, and if there are external callees, we conservatively avoid adding the `norecurse` attribute.
With this approach, we can also infer `norecurse` when the function calls external library functions that aren’t marked `NoCallback`, as long as we can guarantee that no function address escapes.
This check is only applied during the LTO post-link phase, where we have full visibility into all modules. This ensures that any remaining external calls truly originate from outside the program (e.g., libraries), not other LTO modules.
Please let me know your thoughts on this approach.
https://github.com/llvm/llvm-project/pull/139943
More information about the llvm-commits
mailing list