[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions
authorMomchil Velikov <momchil.velikov@arm.com>
Mon, 1 Aug 2022 05:48:22 +0000 (06:48 +0100)
committerMomchil Velikov <momchil.velikov@arm.com>
Mon, 1 Aug 2022 06:55:14 +0000 (07:55 +0100)
commit7b0f6378e211e881c574748090a86beeab264ab3
tree2bce831645c06a13499fb62083e605e417383f21
parentf1d274b5c6811f3855cee4b44ba18de8818774cf
[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions

SimplifyCFG does some common code hoisting, which is limited to hoisting a
sequence of identical instruction in identical order and stops at the first
non-identical instruction.

This patch allows hoisting instruction pairs over same-length sequences of
non-matching instructions. The linear asymptotic complexity of the algorithm
stays the same, there's an extra parameter `simplifycfg-hoist-common-skip-limit`
serving to limit compilation time and/or the size of the hoisted live ranges.

The patch improves SPECv6/525.x264_r by about 10%.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D129370
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/hoist-common-skip-limit.ll [new file with mode: 0644]
llvm/test/Transforms/SimplifyCFG/hoist-common-skip.ll [new file with mode: 0644]