[llvm] r283519 - [llvm-opt-report] Left justify unrolling counts, etc.

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 19:01:03 PDT 2016


Author: hfinkel
Date: Thu Oct  6 21:01:03 2016
New Revision: 283519

URL: http://llvm.org/viewvc/llvm-project?rev=283519&view=rev
Log:
[llvm-opt-report] Left justify unrolling counts, etc.

In the left part of the reports, we have things like U<number>; 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.

Modified:
    llvm/trunk/tools/llvm-opt-report/OptReport.cpp

Modified: llvm/trunk/tools/llvm-opt-report/OptReport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-opt-report/OptReport.cpp?rev=283519&r1=283518&r2=283519&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-opt-report/OptReport.cpp (original)
+++ llvm/trunk/tools/llvm-opt-report/OptReport.cpp Thu Oct  6 21:01:03 2016
@@ -412,8 +412,12 @@ static bool writeReport(LocationInfoTy &
         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 &
                      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();
         };
 




More information about the llvm-commits mailing list