diff options
author | Jinsong Ji <jji@us.ibm.com> | 2019-08-22 13:44:47 +0000 |
---|---|---|
committer | Jinsong Ji <jji@us.ibm.com> | 2019-08-22 13:44:47 +0000 |
commit | 545e993b8b0c39c9622924cd6467e3adc9b075a4 (patch) | |
tree | e3e8b128aec454c21a19e27399e7f0c8833e4953 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 589cb004dee799a097b878a8a13e4ba43114d5bd (diff) | |
download | bcm5719-llvm-545e993b8b0c39c9622924cd6467e3adc9b075a4.tar.gz bcm5719-llvm-545e993b8b0c39c9622924cd6467e3adc9b075a4.zip |
[SlotIndexes] Add print-slotindexes to disable printing slotindexes
Summary:
When we print the IR with --print-after/before-*,
SlotIndexes will be printed whenever available (We haven't freed it).
This introduces some noises when we try to compare the IR
among different optimizations.
eg:
-print-before=machine-cp will print SlotIndexes for 1st machine-cp
pass, but NOT for 2nd machine-cp;
-print-after=machine-cp will NOT print SlotIndexes for both
machine-cp passes.
So SlotIndexes in 1st pass introduce noises when differing these IRs.
This patch introduces an option to hide indexes.
Reviewers: stoklund, thegameg, qcolombet
Reviewed By: thegameg
Subscribers: hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66500
llvm-svn: 369650
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index f57a0424d33..a312d14dd45 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -39,6 +39,12 @@ using namespace llvm; #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 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, return; } - if (Indexes) + if (Indexes && PrintSlotIndexes) OS << Indexes->getMBBStartIdx(this) << '\t'; OS << "bb." << getNumber(); @@ -402,7 +408,7 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, bool IsInBundle = false; for (const MachineInstr &MI : instrs()) { - if (Indexes) { + if (Indexes && PrintSlotIndexes) { if (Indexes->hasIndex(MI)) OS << Indexes->getInstructionIndex(MI); OS << '\t'; |