mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-19 03:29:22 +00:00
Fix bug: FunctionResolve/2003-07-23-CPR-Reference.ll
This fixes a long time annoyance which caused prototypes for bzero, bcopy, bcmp, fputs, and fputs_unlocked to never get deleted. Grr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7285 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a99d4f2975
commit
1078d11854
@ -80,12 +80,14 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
|
|||||||
// functions and that the Old function has no varargs fns specified. In
|
// functions and that the Old function has no varargs fns specified. In
|
||||||
// otherwords it's just <retty> (...)
|
// otherwords it's just <retty> (...)
|
||||||
//
|
//
|
||||||
|
if (!Old->use_empty()) { // Avoid making the CPR unless we really need it
|
||||||
Value *Replacement = Concrete;
|
Value *Replacement = Concrete;
|
||||||
if (Concrete->getType() != Old->getType())
|
if (Concrete->getType() != Old->getType())
|
||||||
Replacement = ConstantExpr::getCast(ConstantPointerRef::get(Concrete),
|
Replacement = ConstantExpr::getCast(ConstantPointerRef::get(Concrete),
|
||||||
Old->getType());
|
Old->getType());
|
||||||
NumResolved += Old->use_size();
|
NumResolved += Old->use_size();
|
||||||
Old->replaceAllUsesWith(Replacement);
|
Old->replaceAllUsesWith(Replacement);
|
||||||
|
}
|
||||||
|
|
||||||
// Since there are no uses of Old anymore, remove it from the module.
|
// Since there are no uses of Old anymore, remove it from the module.
|
||||||
M.getFunctionList().erase(Old);
|
M.getFunctionList().erase(Old);
|
||||||
|
Loading…
Reference in New Issue
Block a user