1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[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 cb201d8d91
commit 2aa4f29a7e

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;