From 5d41f032159c4e9dcd0f7bed5b0bf8218328a585 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Fri, 7 Oct 2016 02:01:03 +0000 Subject: [PATCH] [llvm-opt-report] Left justify unrolling counts, etc. In the left part of the reports, we have things like U; if some of these numbers use more digits than others, we don't want a space in between the U and the start of the number. Instead, the space should come afterward. This way it is clear that the number goes with the U and not any other optimization indicator that might come later on the line. Tests committed in r283518. llvm-svn: 283519 --- llvm/tools/llvm-opt-report/OptReport.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/llvm/tools/llvm-opt-report/OptReport.cpp b/llvm/tools/llvm-opt-report/OptReport.cpp index 0e5d7b7..b82a73b 100644 --- a/llvm/tools/llvm-opt-report/OptReport.cpp +++ b/llvm/tools/llvm-opt-report/OptReport.cpp @@ -412,8 +412,12 @@ static bool writeReport(LocationInfoTy &LocationInfo) { auto UStr = [UCDigits](OptReportLocationInfo &LLI) { std::string R; raw_string_ostream RS(R); - if (!Succinct) - RS << llvm::format_decimal(LLI.UnrollCount, UCDigits); + + if (!Succinct) { + RS << LLI.UnrollCount; + RS << std::string(UCDigits - RS.str().size(), ' '); + } + return RS.str(); }; @@ -421,9 +425,12 @@ static bool writeReport(LocationInfoTy &LocationInfo) { ICDigits](OptReportLocationInfo &LLI) -> std::string { std::string R; raw_string_ostream RS(R); - if (!Succinct) - RS << llvm::format_decimal(LLI.VectorizationFactor, VFDigits) << - "," << llvm::format_decimal(LLI.InterleaveCount, ICDigits); + + if (!Succinct) { + RS << LLI.VectorizationFactor << "," << LLI.InterleaveCount; + RS << std::string(VFDigits + ICDigits + 1 - RS.str().size(), ' '); + } + return RS.str(); }; -- 2.7.4