[llvm-dev] Question about pickTracePred() in MachineTraceMetrics

Hsiangkai Wang via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 20 19:30:14 PST 2017


Hi all,

I have a question about MachineTraceMetrics.

The definition of depth of block in MachineTraceMetrics is defined as
the accumulated number of instructions in the trace above the block.
Does not include instructions in this block.

In MachineTraceMetrics::Ensemble::computeDepthResources(), we could
see the definition when computing depth of a basic block as follow.

TBI->InstrDepth = PredTBI->InstrDepth + PredFBI->InstrCount;

TBI is current basic block's trace info.
PredTBI is predecessor's trace info.
PredFBI is predecessor's fixed trace info.
That is, current block depth is summation of predecessor's depth and
predecessor's instruction count.

However, in MinInstrCountEnsemble::pickTracePred(), it uses
predecessor's depth plus current basic block's instruction count as
depth to pick the smallest one. Why? The summation is not aligned with
the definition.
Is there any reason to do so or is it a bug in MinInstrCountEnsemble?

Thanks in advance.


More information about the llvm-dev mailing list