aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineTraceMetrics.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2015-07-04 15:00:28 +0000
committerSanjay Patel <spatel@rotateright.com>2015-07-04 15:00:28 +0000
commit82db3b7d5ee98eb8f511d683e250eea720c52425 (patch)
tree4dc814db1877a4f4d43f32eb872d917e95e1693c /llvm/lib/CodeGen/MachineTraceMetrics.cpp
parentfffc068d68b657a7282305476c9ee84ed4e7897f (diff)
downloadllvm-82db3b7d5ee98eb8f511d683e250eea720c52425.zip
llvm-82db3b7d5ee98eb8f511d683e250eea720c52425.tar.gz
llvm-82db3b7d5ee98eb8f511d683e250eea720c52425.tar.bz2
use valid bits to avoid unnecessary machine trace metric recomputations
Although this does cut the number of traces recomputed by ~10% for the test case mentioned in http://reviews.llvm.org/D10460, it doesn't make a dent in the overall performance. That example needs to be more selective when invalidating traces. llvm-svn: 241393
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineTraceMetrics.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp
index f9adba0..10a984c 100644
--- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp
+++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp
@@ -1131,11 +1131,16 @@ computeInstrHeights(const MachineBasicBlock *MBB) {
MachineTraceMetrics::Trace
MachineTraceMetrics::Ensemble::getTrace(const MachineBasicBlock *MBB) {
- // FIXME: Check cache tags, recompute as needed.
- computeTrace(MBB);
- computeInstrDepths(MBB);
- computeInstrHeights(MBB);
- return Trace(*this, BlockInfo[MBB->getNumber()]);
+ TraceBlockInfo &TBI = BlockInfo[MBB->getNumber()];
+
+ if (!TBI.hasValidDepth() || !TBI.hasValidHeight())
+ computeTrace(MBB);
+ if (!TBI.HasValidInstrDepths)
+ computeInstrDepths(MBB);
+ if (!TBI.HasValidInstrHeights)
+ computeInstrHeights(MBB);
+
+ return Trace(*this, TBI);
}
unsigned