summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2008-09-06 17:44:06 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2008-09-06 17:44:06 +0000
commit421f488cb7ba0798bb696ae363c79b526df8d3f7 (patch)
treeeaf50efbcd7fea092b74d27effa5e074fc300533
parent95c2a7848ad8579a4d551078cd36501b28ad935d (diff)
downloadbcm5719-llvm-421f488cb7ba0798bb696ae363c79b526df8d3f7.tar.gz
bcm5719-llvm-421f488cb7ba0798bb696ae363c79b526df8d3f7.zip
fix crash when the malloc/free function is defined or is a declaration with 0 parameters.
this pass doesnt seem to be used, but still it's now a little more correct llvm-svn: 55873
-rw-r--r--llvm/lib/Transforms/IPO/IndMemRemoval.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/IndMemRemoval.cpp b/llvm/lib/Transforms/IPO/IndMemRemoval.cpp
index 2e09fe967f4..b251ab4b09c 100644
--- a/llvm/lib/Transforms/IPO/IndMemRemoval.cpp
+++ b/llvm/lib/Transforms/IPO/IndMemRemoval.cpp
@@ -51,8 +51,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
//happen through intrinsics.
bool changed = false;
if (Function* F = M.getFunction("free")) {
- assert(F->isDeclaration() && "free not external?");
- if (!F->use_empty()) {
+ if (F->isDeclaration() && F->arg_size() == 1 && !F->use_empty()) {
Function* FN = Function::Create(F->getFunctionType(),
GlobalValue::LinkOnceLinkage,
"free_llvm_bounce", &M);
@@ -66,8 +65,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
}
}
if (Function* F = M.getFunction("malloc")) {
- assert(F->isDeclaration() && "malloc not external?");
- if (!F->use_empty()) {
+ if (F->isDeclaration() && F->arg_size() == 1 && !F->use_empty()) {
Function* FN = Function::Create(F->getFunctionType(),
GlobalValue::LinkOnceLinkage,
"malloc_llvm_bounce", &M);
OpenPOWER on IntegriCloud