[SimplifyCFG] Allow SimplifyCFG hoisting to skip over non-matching instructions
authorMomchil Velikov <momchil.velikov@arm.com>
Mon, 5 Sep 2022 11:25:03 +0000 (12:25 +0100)
committerMomchil Velikov <momchil.velikov@arm.com>
Mon, 5 Sep 2022 14:13:46 +0000 (15:13 +0100)
commit078899cd64cd2fb787c2c5356e16dd818ee3ad23
tree42691d91d92a741b905e33a343983e6700670d86
parent99d364d1f430f9727eb5d5e71889790f2dcab3e6
[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: nikic, 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]