[llvm] [SimplifyCFG] Increase budget for FoldTwoEntryPHINode() if the branch is unpredictable. (PR #98495)

Tianqing Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 00:20:13 PDT 2024


tianqingw wrote:

> I'm wondering if it's possible to remove the `FoldTwoEntryPHINode` altogether and hand it in EarlyIfConversion.

This is intended to be a minimum viable product for 19.x. That's the reason why it's limited to x86 target for the time being. Moving to EarlyIfConversion can be a next step.

>  The SimplifyCFG should only perform some trivial transforms from if to select in this context.

It is still "transforms from if to select". `FoldTwoEntryPHINode()` does things in a very conservative way, that it'll only fold if every instruction in `IfTrue` and `IfFalse` has no side effect, and can be traced from the operands of PHI. No change is done to these instructions. 

I added a `SpeculateUnpredictables` option to prevent redundant runs.

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


More information about the llvm-commits mailing list