]> granicus.if.org Git - llvm/commit
Recommit [MachineCombiner] Update instruction depths incrementally for large BBs.
authorFlorian Hahn <florian.hahn@arm.com>
Wed, 20 Sep 2017 11:54:37 +0000 (11:54 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Wed, 20 Sep 2017 11:54:37 +0000 (11:54 +0000)
commit6aed42109d5f0b03e0ecfe9fafd1bf852d2a0b8b
tree1cf15cc5f4947256f5488fadab0a15b124e26b6d
parent3907ca9d61b2acad5b641e2c3d1bb2665d8b614b
Recommit [MachineCombiner] Update instruction depths incrementally for large BBs.

This version of the patch fixes an off-by-one error causing PR34596. We
do not need to use std::next(BlockIter) when calling updateDepths, as
BlockIter already points to the next element.

Original commit message:
> For large basic blocks with lots of combinable instructions, the
> MachineTraceMetrics computations in MachineCombiner can dominate the compile
> time, as computing the trace information is quadratic in the number of
> instructions in a BB and it's relevant successors/predecessors.

> In most cases, knowing the instruction depth should be enough to make
> combination decisions. As we already iterate over all instructions in a basic
> block, the instruction depth can be computed incrementally. This reduces the
> cost of machine-combine drastically in cases where lots of instructions
> are combined. The major drawback is that AFAIK, computing the critical path
> length cannot be done incrementally. Therefore we only compute
> instruction depths incrementally, for basic blocks with more
> instructions than inc_threshold. The -machine-combiner-inc-threshold
> option can be used to set the threshold and allows for easier
> experimenting and checking if using incremental updates for all basic
> blocks has any impact on the performance.
>
> Reviewers: sanjoy, Gerolf, MatzeB, efriedma, fhahn
>
> Reviewed By: fhahn
>
> Subscribers: kiranchandramohan, javed.absar, efriedma, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D36619

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313751 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/MachineTraceMetrics.h
lib/CodeGen/MachineCombiner.cpp
lib/CodeGen/MachineTraceMetrics.cpp
test/CodeGen/AArch64/machine-combiner.ll
test/CodeGen/X86/machine-combiner.ll
test/CodeGen/X86/mul-constant-result.ll