aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-31 00:21:59 +0000
committerChris Lattner <sabre@nondot.org>2003-08-31 00:21:59 +0000
commit034636444b77c82c420c7f6d8c4014aa559b28e2 (patch)
treee604cfb6749334ce59954808c31980ef17e0a555 /lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
parent30aef423d16f351b311557743e12d2686b722243 (diff)
Use the new interface, simplifies code
NOTE that these two files are _BUGGY_ and need to be fixed, just not by me :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8241 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp')
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
index a74d5c75b1..1c0ec3b9ae 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
@@ -121,6 +121,12 @@ void InstLoops::findAndInstrumentBackEdges(Function &F){
removeRedundant(be);
+ // FIXME: THIS IS HORRIBLY BROKEN. FunctionPass's cannot do this, except in
+ // their initialize function!!
+ Function *inCountMth =
+ F.getParent()->getOrInsertFunction("llvm_first_trigger",
+ Type::VoidTy, 0);
+
for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
ME = be.end(); MI != ME; ++MI){
BasicBlock *u = MI->first;
@@ -138,15 +144,6 @@ void InstLoops::findAndInstrumentBackEdges(Function &F){
BasicBlock::InstListType &lt = newBB->getInstList();
- std::vector<const Type*> inCountArgs;
- const FunctionType *cFty = FunctionType::get(Type::VoidTy, inCountArgs,
- false);
- Function *inCountMth =
- u->getParent()->getParent()->getOrInsertFunction("llvm_first_trigger",
- cFty);
-
- assert(inCountMth && "Initial method could not be inserted!");
-
Instruction *call = new CallInst(inCountMth);
lt.push_back(call);
lt.push_back(new BranchInst(BB));