[llvm] [Analysis]: Allow inlining recursive call IF recursion depth is 1. (PR #119677)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 03:44:23 PST 2024


nikic wrote:

> But I think that the correct place could be visitCallBase? because the simplification will depend on the arguments of the next iteration of the function, which are the arguments of the CallBase. So I think the flow could start from visitCallBase and then simplifyCallSite(..) which will check if this callsite is guarded by a ComInst that is using one of the arguments, and then the flow ends by calling visitCmpInstWithOps, because I need the CmpInst to work on the new argument of the next iteration. What do you think ?

I don't think that visitCallBase is the right place. The instruction that actually gets simplified is the icmp (which then results in a dead block -- which means that we will not cost any of the instructions in that block, not just the call itself). You *do* need to use the information from the call, but I think visitCmpInst is the right place to use it.

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


More information about the llvm-commits mailing list