This is a port of the functionality from SelectionDAG, which tries to find a tree of conditions from compares that are then combined using OR or AND, before using that result as the input to a branch. Instead of naively lowering the code as is, this change converts that into a sequence of conditional branches on the sub-expressions of the tree.
Like SelectionDAG, we re-use the case block codegen functionality from the switch lowering utils, which causes us to generate some different code. The result of which I've tried to mitigate in earlier combine patches.
I don't think this is strictly necessary for GlobalISel because we don't have to care about values being exported across basic blocks. However, I'd like to port over the functionality as is for now, and then remove it later after doing some performance tests to check the impact.