diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2008-09-06 17:44:06 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2008-09-06 17:44:06 +0000 |
commit | b9baf3167908fc56f7ed49d0b31fe25237bca841 (patch) | |
tree | 91288e297cbade5f5b211fa7fc268e45f4a4751c /lib | |
parent | fec2c2bf5ea14679f8a2d74a72bdec76f05fa001 (diff) | |
download | external_llvm-b9baf3167908fc56f7ed49d0b31fe25237bca841.zip external_llvm-b9baf3167908fc56f7ed49d0b31fe25237bca841.tar.gz external_llvm-b9baf3167908fc56f7ed49d0b31fe25237bca841.tar.bz2 |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55873 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/IndMemRemoval.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp index 2e09fe9..b251ab4 100644 --- a/lib/Transforms/IPO/IndMemRemoval.cpp +++ b/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); |