mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
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
This commit is contained in:
parent
c4ec7871bf
commit
a03bc9ce10
@ -51,8 +51,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
|
|||||||
//happen through intrinsics.
|
//happen through intrinsics.
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
if (Function* F = M.getFunction("free")) {
|
if (Function* F = M.getFunction("free")) {
|
||||||
assert(F->isDeclaration() && "free not external?");
|
if (F->isDeclaration() && F->arg_size() == 1 && !F->use_empty()) {
|
||||||
if (!F->use_empty()) {
|
|
||||||
Function* FN = Function::Create(F->getFunctionType(),
|
Function* FN = Function::Create(F->getFunctionType(),
|
||||||
GlobalValue::LinkOnceLinkage,
|
GlobalValue::LinkOnceLinkage,
|
||||||
"free_llvm_bounce", &M);
|
"free_llvm_bounce", &M);
|
||||||
@ -66,8 +65,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Function* F = M.getFunction("malloc")) {
|
if (Function* F = M.getFunction("malloc")) {
|
||||||
assert(F->isDeclaration() && "malloc not external?");
|
if (F->isDeclaration() && F->arg_size() == 1 && !F->use_empty()) {
|
||||||
if (!F->use_empty()) {
|
|
||||||
Function* FN = Function::Create(F->getFunctionType(),
|
Function* FN = Function::Create(F->getFunctionType(),
|
||||||
GlobalValue::LinkOnceLinkage,
|
GlobalValue::LinkOnceLinkage,
|
||||||
"malloc_llvm_bounce", &M);
|
"malloc_llvm_bounce", &M);
|
||||||
|
Loading…
Reference in New Issue
Block a user