summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineTraceMetrics.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2017-09-20 11:54:37 +0000
committerFlorian Hahn <florian.hahn@arm.com>2017-09-20 11:54:37 +0000
commitceb4494786f9b90f5bcef7b76a1a704bb90b7b20 (patch)
tree44416c070d43b70c9ed6a406e7048f4f03cb7b50 /llvm/lib/CodeGen/MachineTraceMetrics.cpp
parent8dceb7606663d47c8a76acf0bec23a46a191b31c (diff)
downloadbcm5719-llvm-ceb4494786f9b90f5bcef7b76a1a704bb90b7b20.tar.gz
bcm5719-llvm-ceb4494786f9b90f5bcef7b76a1a704bb90b7b20.zip
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 llvm-svn: 313751
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineTraceMetrics.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp
index 91555677e42..296f6001d21 100644
--- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp
+++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp
@@ -824,6 +824,14 @@ updateDepth(const MachineBasicBlock *MBB, const MachineInstr &UseMI,
updateDepth(BlockInfo[MBB->getNumber()], UseMI, RegUnits);
}
+void MachineTraceMetrics::Ensemble::
+updateDepths(MachineBasicBlock::iterator Start,
+ MachineBasicBlock::iterator End,
+ SparseSet<LiveRegUnit> &RegUnits) {
+ for (; Start != End; Start++)
+ updateDepth(Start->getParent(), *Start, RegUnits);
+}
+
/// Compute instruction depths for all instructions above or in MBB in its
/// trace. This assumes that the trace through MBB has already been computed.
void MachineTraceMetrics::Ensemble::
OpenPOWER on IntegriCloud