[llvm] r241393 - use valid bits to avoid unnecessary machine trace metric recomputations

Sanjay Patel spatel at rotateright.com
Sat Jul 4 08:00:29 PDT 2015


Author: spatel
Date: Sat Jul  4 10:00:28 2015
New Revision: 241393

URL: http://llvm.org/viewvc/llvm-project?rev=241393&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp

Modified: llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp?rev=241393&r1=241392&r2=241393&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp Sat Jul  4 10:00:28 2015
@@ -1131,11 +1131,16 @@ computeInstrHeights(const MachineBasicBl
 
 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





More information about the llvm-commits mailing list