When we are compiling for -Os or -Oz, performing if conversion to conditional select when the two branches of the if have exactly one instruction in them tends to generate more code.
We prevent it at three stages. The first is in early if conversion. We count the number of instructions in each block and if it is less than two we return without changes.
The next is in the tail duplicator. If there are no select or GEP instructions in the layout predecessor of the tail duplicated block, then we do not splice the tail duplicated block into the layout predecessor. This prevents generation of some unnecessary branches.
The third is in simplify CFG. If the if statement results in a two entry PHI node at the beginning of a basic block, then we try to fold it into a SELECT. In case the incoming edges to the PHI node are from basic blocks having exactly one instruction, we prevent the generation of this SELECT.