[llvm-mca] Fix a rounding problem in SummaryView.cpp exposed by r333204.

Before printing the block reciprocal throughput, ensure that the floating point
number is always rounded the same way on every target.
No functional change intended.

llvm-svn: 333210
This commit is contained in:
Andrea Di Biagio 2018-05-24 17:22:14 +00:00
parent 4b25b3e4a6
commit 0af811519a
1 changed files with 7 additions and 4 deletions

View File

@ -34,9 +34,9 @@ void SummaryView::onInstructionEvent(const HWInstructionEvent &Event) {
return;
// Update the cumulative number of resource cycles based on the processor
// resource usage information available from the instruction descriptor. We need to
// compute the cumulative number of resource cycles for every processor
// resource which is consumed by an instruction of the block.
// resource usage information available from the instruction descriptor. We
// need to compute the cumulative number of resource cycles for every
// processor resource which is consumed by an instruction of the block.
const Instruction &Inst = *Event.IR.getInstruction();
const InstrDesc &Desc = Inst.getDesc();
NumMicroOps += Desc.NumMicroOps;
@ -99,7 +99,10 @@ void SummaryView::printView(raw_ostream &OS) const {
TempStream << "\nTotal Cycles: " << TotalCycles;
TempStream << "\nDispatch Width: " << DispatchWidth;
TempStream << "\nIPC: " << format("%.2f", IPC);
TempStream << "\nBlock RThroughput: " << format("%.1f", BlockRThroughput)
// Round to the block reciprocal throughput to the nearest tenth.
TempStream << "\nBlock RThroughput: "
<< format("%.1f", floor((BlockRThroughput * 10) + 0.5) / 10)
<< '\n';
TempStream.flush();
OS << Buffer;