[UnifyLoopExits] Reduce number of guard blocks
UnifyLoopExits creates a single exit, a control flow hub, for loops with multiple exits. There is an input to the block for each loop exiting block and an output from the block for each loop exit block. Multiple checks, or guard blocks, are needed to branch to the correct exit block. For large loops with lots of exit blocks, all the extra guard blocks cause problems for StructurizeCFG and subsequent passes. This patch reduces the number of guard blocks needed when the exit blocks branch to a common block (e.g., an unreachable block). The guard blocks are reduced by changing the inputs and outputs of the control flow hub. The inputs are the exit blocks and the outputs are the common block. Reducing the guard blocks enables StructurizeCFG to reorder the basic blocks in the CFG to reduce the values that exit a loop with multiple exits. This reduces the compile-time of StructurizeCFG and also reduces register pressure. Differential Revision: https://reviews.llvm.org/D123230
Loading
Please sign in to comment