[llvm] r324769 - [CodeGen] Print predecessors as MIR comments in -debug output

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 11:46:02 PST 2018


Author: thegameg
Date: Fri Feb  9 11:46:02 2018
New Revision: 324769

URL: http://llvm.org/viewvc/llvm-project?rev=324769&view=rev
Log:
[CodeGen] Print predecessors as MIR comments in -debug output

Make -debug MBB headers more copy-pastable into mir files.

Modified:
    llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=324769&r1=324768&r2=324769&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Fri Feb  9 11:46:02 2018
@@ -374,9 +374,13 @@ void MachineBasicBlock::print(raw_ostrea
   // Print the preds of this block according to the CFG.
   if (!pred_empty()) {
     if (Indexes) OS << '\t';
-    OS << "    Predecessors according to CFG:";
-    for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI)
-      OS << " " << printMBBReference(*(*PI));
+    // Don't indent(2), align with previous line attributes.
+    OS << "; predecessors: ";
+    for (auto I = pred_begin(), E = pred_end(); I != E; ++I) {
+      if (I != pred_begin())
+        OS << ", ";
+      OS << printMBBReference(**I);
+    }
     OS << '\n';
   }
 




More information about the llvm-commits mailing list