summaryrefslogtreecommitdiffstats
path: root/tools/llvm-prof
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-07-04 13:58:26 +0000
committered <ed@FreeBSD.org>2009-07-04 13:58:26 +0000
commit72621d11de5b873f1695f391eb95f0b336c3d2d4 (patch)
tree84360c8989c912127a383af37c4b1aa5767bd16e /tools/llvm-prof
parentcf5cd875b51255602afaed29deb636b66b295671 (diff)
downloadFreeBSD-src-72621d11de5b873f1695f391eb95f0b336c3d2d4.zip
FreeBSD-src-72621d11de5b873f1695f391eb95f0b336c3d2d4.tar.gz
Import LLVM 74788.
Diffstat (limited to 'tools/llvm-prof')
-rw-r--r--tools/llvm-prof/llvm-prof.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp
index 119dc1a..2cff296 100644
--- a/tools/llvm-prof/llvm-prof.cpp
+++ b/tools/llvm-prof/llvm-prof.cpp
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/InstrTypes.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/Assembly/AsmAnnotationWriter.h"
#include "llvm/Analysis/ProfileInfoLoader.h"
@@ -80,8 +81,10 @@ namespace {
virtual void emitBasicBlockStartAnnot(const BasicBlock *BB,
raw_ostream &OS) {
if (BlockFreqs.empty()) return;
- if (unsigned Count = BlockFreqs[BB])
- OS << "\t;;; Basic block executed " << Count << " times.\n";
+ std::map<const BasicBlock *, unsigned>::const_iterator I =
+ BlockFreqs.find(BB);
+ if (I != BlockFreqs.end())
+ OS << "\t;;; Basic block executed " << I->second << " times.\n";
else
OS << "\t;;; Never executed!\n";
}
@@ -115,7 +118,8 @@ int main(int argc, char **argv) {
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
PrettyStackTraceProgram X(argc, argv);
-
+
+ LLVMContext Context;
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
try {
cl::ParseCommandLineOptions(argc, argv, "llvm profile dump decoder\n");
@@ -125,7 +129,7 @@ int main(int argc, char **argv) {
Module *M = 0;
if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BitcodeFile,
&ErrorMessage)) {
- M = ParseBitcodeFile(Buffer, &ErrorMessage);
+ M = ParseBitcodeFile(Buffer, Context, &ErrorMessage);
delete Buffer;
}
if (M == 0) {
OpenPOWER on IntegriCloud