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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 07:55:35 PST 2024


https://github.com/nikic commented:

This looks like something of a hack to me. The way this is supposed to work is that InlineCost constant folds branches, and as a result the recursive call is rendered dead and never visited, such that the IsRecursiveCall flag is never set.

What you are doing here is to essentially add a new heuristic for the branch folding, which is based on a dominating condition in the caller instead of plain constant propagation. If you want to do that, I think the correct place to do it would be as part of the normal visitCmpInst, not as a separate, after the fact check.

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


More information about the llvm-commits mailing list