[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Jul 23 17:04:02 PDT 2003
Changes in directory llvm/lib/Transforms/IPO:
FunctionResolution.cpp updated: 1.32 -> 1.33
---
Log message:
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.
---
Diffs of the changes:
Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.32 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.33
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.32 Thu Jun 19 11:59:19 2003
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Wed Jul 23 17:03:18 2003
@@ -80,12 +80,14 @@
// functions and that the Old function has no varargs fns specified. In
// otherwords it's just <retty> (...)
//
- Value *Replacement = Concrete;
- if (Concrete->getType() != Old->getType())
- Replacement = ConstantExpr::getCast(ConstantPointerRef::get(Concrete),
- Old->getType());
- NumResolved += Old->use_size();
- Old->replaceAllUsesWith(Replacement);
+ if (!Old->use_empty()) { // Avoid making the CPR unless we really need it
+ Value *Replacement = Concrete;
+ if (Concrete->getType() != Old->getType())
+ Replacement = ConstantExpr::getCast(ConstantPointerRef::get(Concrete),
+ Old->getType());
+ NumResolved += Old->use_size();
+ Old->replaceAllUsesWith(Replacement);
+ }
// Since there are no uses of Old anymore, remove it from the module.
M.getFunctionList().erase(Old);
More information about the llvm-commits
mailing list