[llvm] [FuncAttrs] Relax norecurse attribute inference (PR #139943)
Usha Gupta via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 08:05:51 PDT 2025
usha1830 wrote:
> I don't think FunctionAttrs should be performing inference that inspects more than the current SCC.
Hi @nikic, Thanks for reviewing!
Are you referring to the check added to detect unknown external calls in a callee’s call graph?
This check is now necessary because we are no longer checking norecurse on each callee. Without this, we might incorrectly infer norecurse for a function that calls another function with unknown external call.
For example:
`f1 -> f2 -> f3`
If `f3` is an external function with an unknown definition,` f2` will correctly not get norecurse. But without deeper checking, `f1` might still be marked norecurse just because `f2` is internal — which would be incorrect.
An alternative approach could be to ensure that the function F has only direct call users. If there are any non-call uses of F (e.g., being stored to a variable or passed as a function pointer), we should avoid inferring norecurse. This could further uncover more opportunities for inferring norecurse attribute.
https://github.com/llvm/llvm-project/pull/139943
More information about the llvm-commits
mailing list