[PATCH] D113671: [CodeGen] Tweak whitespace in LiveInterval printing

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 06:25:01 PST 2021


foad created this revision.
foad added reviewers: MatzeB, arsenm.
Herald added a subscriber: hiraditya.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113671

Files:
  llvm/lib/CodeGen/LiveInterval.cpp


Index: llvm/lib/CodeGen/LiveInterval.cpp
===================================================================
--- llvm/lib/CodeGen/LiveInterval.cpp
+++ llvm/lib/CodeGen/LiveInterval.cpp
@@ -1020,7 +1020,7 @@
 
   // 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 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 @@
   // Print subranges
   for (const SubRange &SR : subranges())
     OS << SR;
-  OS << " weight:" << Weight;
+  OS << "  weight:" << Weight;
 }
 
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113671.386496.patch
Type: text/x-patch
Size: 973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211111/4e44441e/attachment.bin>


More information about the llvm-commits mailing list