[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hal Finkel 2016-10-07 02:01:03 +00:00
parent 68dd546484
commit 837bcf7984

View File

@ -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();
};