Index: llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
===================================================================
--- llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
+++ llvm/include/llvm/Bitcode/BitcodeAnalyzer.h
@@ -42,6 +42,8 @@
bool Symbolic = false;
/// Print binary blobs using hex escapes.
bool ShowBinaryBlobs = false;
+ /// Print BLOCKINFO block details.
+ bool DumpBlockinfo = false;
BCDumpOptions(raw_ostream &OS) : OS(OS) {}
};
Index: llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -744,8 +744,8 @@
// BLOCKINFO is a special part of the stream.
bool DumpRecords = O.hasValue();
if (BlockID == bitc::BLOCKINFO_BLOCK_ID) {
- if (O)
- O->OS << Indent << "\n";
+ if (O && !O->DumpBlockinfo)
+ O->OS << Indent << "> MaybeNewBlockInfo =
Stream.ReadBlockInfoBlock(/*ReadBlockInfoNames=*/true);
if (!MaybeNewBlockInfo)
@@ -758,8 +758,8 @@
if (Error Err = Stream.JumpToBit(BlockBitStart))
return Err;
// It's not really interesting to dump the contents of the blockinfo
- // block.
- DumpRecords = false;
+ // block, so only do it if the user explicitly requests it.
+ DumpRecords = O && O->DumpBlockinfo;
}
unsigned NumWords = 0;
Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
===================================================================
--- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
+++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
@@ -47,6 +47,10 @@
static cl::opt Dump("dump", cl::desc("Dump low level bitcode trace"),
cl::cat(BCAnalyzerCategory));
+static cl::opt DumpBlockinfo("dump-blockinfo",
+ cl::desc("Include BLOCKINFO details in low"
+ " level dump"));
+
//===----------------------------------------------------------------------===//
// Bitcode specific analysis.
//===----------------------------------------------------------------------===//
@@ -114,6 +118,7 @@
O.Histogram = !NoHistogram;
O.Symbolic = !NonSymbolic;
O.ShowBinaryBlobs = ShowBinaryBlobs;
+ O.DumpBlockinfo = DumpBlockinfo;
ExitOnErr(BA.analyze(
Dump ? Optional(O) : Optional(None),