[PATCH] D66500: [SlotIndexes] Add print-slotindexes to disable printing slotindexes

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 06:44:01 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369650: [SlotIndexes] Add print-slotindexes to disable printing slotindexes (authored by jsji, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66500?vs=216323&id=216605#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66500/new/

https://reviews.llvm.org/D66500

Files:
  llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
  llvm/trunk/test/Other/print-slotindexes.ll


Index: llvm/trunk/test/Other/print-slotindexes.ll
===================================================================
--- llvm/trunk/test/Other/print-slotindexes.ll
+++ llvm/trunk/test/Other/print-slotindexes.ll
@@ -0,0 +1,12 @@
+; RUN: llc -print-after=slotindexes < %s 2>&1 | FileCheck %s --check-prefixes=ALL,SI 
+; RUN: llc -print-after=slotindexes -print-slotindexes=false < %s 2>&1 | FileCheck %s --check-prefixes=ALL,NOSI
+; REQUIRES: default_triple
+define void @foo(){
+  ret void
+}
+
+;CHECK: IR Dump {{.*}}
+;CHECK: # Machine code for function foo{{.*}}
+;SI: {{[0-9]+}}B bb.0 (%ir-block.0)
+;NOSI: {{^}}bb.0 (%ir-block.0)
+
Index: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
@@ -39,6 +39,12 @@
 
 #define DEBUG_TYPE "codegen"
 
+static cl::opt<bool> PrintSlotIndexes(
+    "print-slotindexes",
+    cl::desc("When printing machine IR, annotate instructions and blocks with "
+             "SlotIndexes when available"),
+    cl::init(true), cl::Hidden);
+
 MachineBasicBlock::MachineBasicBlock(MachineFunction &MF, const BasicBlock *B)
     : BB(B), Number(-1), xParent(&MF) {
   Insts.Parent = this;
@@ -291,7 +297,7 @@
     return;
   }
 
-  if (Indexes)
+  if (Indexes && PrintSlotIndexes)
     OS << Indexes->getMBBStartIdx(this) << '\t';
 
   OS << "bb." << getNumber();
@@ -402,7 +408,7 @@
 
   bool IsInBundle = false;
   for (const MachineInstr &MI : instrs()) {
-    if (Indexes) {
+    if (Indexes && PrintSlotIndexes) {
       if (Indexes->hasIndex(MI))
         OS << Indexes->getInstructionIndex(MI);
       OS << '\t';


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66500.216605.patch
Type: text/x-patch
Size: 1713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190822/81976ada/attachment.bin>


More information about the llvm-commits mailing list