summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/IndMemRemoval.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO/IndMemRemoval.cpp')
-rw-r--r--lib/Transforms/IPO/IndMemRemoval.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp
index b55dea2..e7884ec 100644
--- a/lib/Transforms/IPO/IndMemRemoval.cpp
+++ b/lib/Transforms/IPO/IndMemRemoval.cpp
@@ -1,4 +1,4 @@
-//===-- IndMemRemoval.cpp - Remove indirect allocations and frees ----------===//
+//===-- IndMemRemoval.cpp - Remove indirect allocations and frees ---------===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,8 +10,8 @@
// This pass finds places where memory allocation functions may escape into
// indirect land. Some transforms are much easier (aka possible) only if free
// or malloc are not called indirectly.
-// Thus find places where the address of memory functions are taken and construct
-// bounce functions with direct calls of those functions.
+// Thus find places where the address of memory functions are taken and
+// construct bounce functions with direct calls of those functions.
//
//===----------------------------------------------------------------------===//
@@ -55,8 +55,8 @@ bool IndMemRemPass::runOnModule(Module &M) {
Function* FN = Function::Create(F->getFunctionType(),
GlobalValue::LinkOnceAnyLinkage,
"free_llvm_bounce", &M);
- BasicBlock* bb = BasicBlock::Create("entry",FN);
- Instruction* R = ReturnInst::Create(bb);
+ BasicBlock* bb = BasicBlock::Create(M.getContext(), "entry",FN);
+ Instruction* R = ReturnInst::Create(M.getContext(), bb);
new FreeInst(FN->arg_begin(), R);
++NumBounce;
NumBounceSites += F->getNumUses();
@@ -70,11 +70,12 @@ bool IndMemRemPass::runOnModule(Module &M) {
GlobalValue::LinkOnceAnyLinkage,
"malloc_llvm_bounce", &M);
FN->setDoesNotAlias(0);
- BasicBlock* bb = BasicBlock::Create("entry",FN);
+ BasicBlock* bb = BasicBlock::Create(M.getContext(), "entry",FN);
Instruction* c = CastInst::CreateIntegerCast(
- FN->arg_begin(), Type::Int32Ty, false, "c", bb);
- Instruction* a = new MallocInst(Type::Int8Ty, c, "m", bb);
- ReturnInst::Create(a, bb);
+ FN->arg_begin(), Type::getInt32Ty(M.getContext()), false, "c", bb);
+ Instruction* a = new MallocInst(Type::getInt8Ty(M.getContext()),
+ c, "m", bb);
+ ReturnInst::Create(M.getContext(), a, bb);
++NumBounce;
NumBounceSites += F->getNumUses();
F->replaceAllUsesWith(FN);
OpenPOWER on IntegriCloud