This change adjusts the phi handling in known-bits to allow recursing into phi operands, but adjusts the depth parameter to avoid potential exponential compile time growth. Specifically, the remaining depth limit is even divided across the number of operands with the depth per operand adjusted upwards so that the total number of recursion steps is limited to the same value we'd perform on a tree of e.g. binary instructions.
This looks on the surface like it might allow a large degree of fan out, but it doesn't. Some examples follow to help explain.
Term the difference between current depth and max depth as "budget". Max depth currently defaults to 6.
Consider:
- A one operand phi increases depth by one. This behaves just like any non-phi instruction.
- A two operand phi increases depth by half of budget.
- A three operand phi increases depth by two thirds of the remaining budget.
- Etc..
Put this together, and we can only recurse through at most two (non-single operand) phis. The first phi splits the budget, and the second one splits it again. For 2 operands, that means we'd divided budget by 4. Since max budget is 6, that means we're down to per operand budget of 1 (required to preserve prior behavior), and won't recurse further.