If the control flow is divergent too much inside loop, it could be better to avoid to move instructions outside loop.
For example, let's say there is a switch instruction with big number of cases inside loop and the instruction is located in one of the case block. In this case, it is not easy to say the instruction is executed.
This patch checks the number of divergent paths from loop header to block which has the instruction. If the number of divergent paths is bigger than threshold, LICM pass does not move the instruction.
The performance improvement from spec2017 for AArch64 is as below.
Benchmark improvement(%) 500.perlbench_r 2.176103248 502.gcc_r -0.271585852 505.mcf_r 0.511525241 520.omnetpp_r -0.008166838 523.xalancbmk_r 0.488642971 525.x264_r -0.049168496 531.deepsjeng_r 0.021372649 541.leela_r -0.023171636 557.xz_r -0.012851939