[llvm] 417add4 - [CodeGen] Tweak whitespace in LiveInterval printing

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 07:20:15 PST 2021


Author: Jay Foad
Date: 2021-11-11T15:19:32Z
New Revision: 417add4d4e921f090cf23d15a642dc04eff49505

URL: https://github.com/llvm/llvm-project/commit/417add4d4e921f090cf23d15a642dc04eff49505
DIFF: https://github.com/llvm/llvm-project/commit/417add4d4e921f090cf23d15a642dc04eff49505.diff

LOG: [CodeGen] Tweak whitespace in LiveInterval printing

When printing a LiveInterval, tweak the use of single and double spaces
to try to make it clearer that the valnos are associated with the
preceding range or subrange, not the following subrange.

Compare the output before and then after this patch:
%1 [32r,144r:0)  0 at 32r L000000000000000C [32r,144r:0)  0 at 32r L00000000000000F3 [32r,32d:0)  0 at 32r weight:0.000000e+00
%1 [32r,144r:0) 0 at 32r  L000000000000000C [32r,144r:0) 0 at 32r  L00000000000000F3 [32r,32d:0) 0 at 32r  weight:0.000000e+00

Differential Revision: https://reviews.llvm.org/D113671

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveInterval.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 1c51fe6b2a2a..9ded0fb6ae0a 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/lib/CodeGen/LiveInterval.cpp
@@ -1020,7 +1020,7 @@ void LiveRange::print(raw_ostream &OS) const {
 
   // Print value number info.
   if (getNumValNums()) {
-    OS << "  ";
+    OS << ' ';
     unsigned vnum = 0;
     for (const_vni_iterator i = vni_begin(), e = vni_end(); i != e;
          ++i, ++vnum) {
@@ -1039,8 +1039,8 @@ void LiveRange::print(raw_ostream &OS) const {
 }
 
 void LiveInterval::SubRange::print(raw_ostream &OS) const {
-  OS << " L" << PrintLaneMask(LaneMask) << ' '
-     << static_cast<const LiveRange&>(*this);
+  OS << "  L" << PrintLaneMask(LaneMask) << ' '
+     << static_cast<const LiveRange &>(*this);
 }
 
 void LiveInterval::print(raw_ostream &OS) const {
@@ -1049,7 +1049,7 @@ void LiveInterval::print(raw_ostream &OS) const {
   // Print subranges
   for (const SubRange &SR : subranges())
     OS << SR;
-  OS << " weight:" << Weight;
+  OS << "  weight:" << Weight;
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)


        


More information about the llvm-commits mailing list