This patch adds a parameter limiting how deep in a block we go looking
for instructions to hoist.
It also prevents certain instructions from initiating the hoist of a
dependency chain with the goal to not separate them from their
users. Such instructions are:
- GEPs, with the intent to keep them together with the (comparatively harder to hoist) loads/stores
- binary ops, which are converted to boolean by comparing them to zero: often the result of comparison to zero is (or can be chosen to be) a side effect from the original computation
- conditions to br and select instructions
Nevertheless, such instructions can be hoisted, if the process starts
from their users.
clang-format: please reformat the code
-static cl::opt<uint32_t> MaxChainLength( - "simple-gvn-hoist-max-chain-length", cl::Hidden, cl::init(10), - cl::desc("Limit the length of dependency chains")); +static cl::opt<uint32_t> + MaxChainLength("simple-gvn-hoist-max-chain-length", cl::Hidden, + cl::init(10), + cl::desc("Limit the length of dependency chains"));