summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-08 17:43:09 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-08 17:43:09 +0000
commit3b5008e23abb2f6fbe85e32670a5437dc3b05a93 (patch)
treeb5d5fe3856941bfffa31d26ab43c2d9a473c6b2b /llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
parent72dd2eef36d04cff7d3941bb4f4822b4ffee86b2 (diff)
downloadbcm5719-llvm-3b5008e23abb2f6fbe85e32670a5437dc3b05a93.tar.gz
bcm5719-llvm-3b5008e23abb2f6fbe85e32670a5437dc3b05a93.zip
More ProfileInfo improvements.
- Part of optimal static profiling patch sequence by Andreas Neustifter. - Store edge, block, and function information separately for each functions (instead of in one giant map). - Return frequencies as double instead of int, and use a sentinel value for missing information. llvm-svn: 78477
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp b/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
index 9139c92235b..91020755c21 100644
--- a/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BlockProfiling.cpp
@@ -106,7 +106,8 @@ bool BlockProfiler::runOnModule(Module &M) {
unsigned NumBlocks = 0;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- NumBlocks += I->size();
+ if (!I->isDeclaration())
+ NumBlocks += I->size();
const Type *ATy = ArrayType::get(Type::Int32Ty, NumBlocks);
GlobalVariable *Counters =
@@ -115,10 +116,12 @@ bool BlockProfiler::runOnModule(Module &M) {
// Instrument all of the blocks...
unsigned i = 0;
- for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
+ if (I->isDeclaration()) continue;
for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB)
// Insert counter at the start of the block
IncrementCounterInBlock(BB, i++, Counters);
+ }
// Add the initialization call to main.
InsertProfilingInitCall(Main, "llvm_start_block_profiling", Counters);
OpenPOWER on IntegriCloud