summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index e784c88344d..09e5220b919 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -29,7 +29,9 @@
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/DataStream.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -38,6 +40,11 @@
using namespace llvm;
+static cl::opt<bool> PrintSummaryGUIDs(
+ "print-summary-global-ids", cl::init(false), cl::Hidden,
+ cl::desc(
+ "Print the global id for each value when reading the module summary"));
+
namespace {
enum {
SWITCH_INST_MAGIC = 0x4B5 // May 2012 => 1205 => Hex
@@ -5520,8 +5527,11 @@ std::error_code ModuleSummaryIndexBitcodeReader::parseValueSymbolTable(
"No linkage found for VST entry?");
std::string GlobalId = GlobalValue::getGlobalIdentifier(
ValueName, VLI->second, SourceFileName);
- TheIndex->addGlobalValueInfo(GlobalId, std::move(GlobalValInfo));
- ValueIdToCallGraphGUIDMap[ValueID] = GlobalValue::getGUID(GlobalId);
+ auto ValueGUID = GlobalValue::getGUID(GlobalId);
+ if (PrintSummaryGUIDs)
+ dbgs() << "GUID " << ValueGUID << " is " << ValueName << "\n";
+ TheIndex->addGlobalValueInfo(ValueGUID, std::move(GlobalValInfo));
+ ValueIdToCallGraphGUIDMap[ValueID] = ValueGUID;
ValueName.clear();
break;
}
@@ -5540,9 +5550,11 @@ std::error_code ModuleSummaryIndexBitcodeReader::parseValueSymbolTable(
"No linkage found for VST entry?");
std::string FunctionGlobalId = GlobalValue::getGlobalIdentifier(
ValueName, VLI->second, SourceFileName);
- TheIndex->addGlobalValueInfo(FunctionGlobalId, std::move(FuncInfo));
- ValueIdToCallGraphGUIDMap[ValueID] =
- GlobalValue::getGUID(FunctionGlobalId);
+ auto FunctionGUID = GlobalValue::getGUID(FunctionGlobalId);
+ if (PrintSummaryGUIDs)
+ dbgs() << "GUID " << FunctionGUID << " is " << ValueName << "\n";
+ TheIndex->addGlobalValueInfo(FunctionGUID, std::move(FuncInfo));
+ ValueIdToCallGraphGUIDMap[ValueID] = FunctionGUID;
ValueName.clear();
break;
OpenPOWER on IntegriCloud