[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp GlobalOpt.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Jan 31 17:23:44 PST 2005
Changes in directory llvm/lib/Transforms/IPO:
FunctionResolution.cpp updated: 1.54 -> 1.55
GlobalOpt.cpp updated: 1.33 -> 1.34
---
Log message:
Adjust to changes in APIs
---
Diffs of the changes: (+10 -16)
FunctionResolution.cpp | 6 +++---
GlobalOpt.cpp | 20 +++++++-------------
2 files changed, 10 insertions(+), 16 deletions(-)
Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.54 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.55
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.54 Wed Sep 29 19:12:29 2004
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Mon Jan 31 19:23:31 2005
@@ -98,11 +98,11 @@
// functions and that the Old function has no varargs fns specified. In
// otherwords it's just <retty> (...)
//
- if (!Old->use_empty()) { // Avoid making the CPR unless we really need it
+ if (!Old->use_empty()) {
Value *Replacement = Concrete;
if (Concrete->getType() != Old->getType())
- Replacement = ConstantExpr::getCast(Concrete,Old->getType());
- NumResolved += Old->use_size();
+ Replacement = ConstantExpr::getCast(Concrete, Old->getType());
+ NumResolved += Old->getNumUses();
Old->replaceAllUsesWith(Replacement);
}
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.33 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.34
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.33 Sat Jan 8 13:45:31 2005
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Mon Jan 31 19:23:31 2005
@@ -361,7 +361,8 @@
else
assert(0 && "Unknown aggregate sequential type!");
- if (NumElements > 16 && GV->use_size() > 16) return 0; // It's not worth it.
+ if (NumElements > 16 && GV->getNumUses() > 16)
+ return 0; // It's not worth it.
NewGlobals.reserve(NumElements);
for (unsigned i = 0, e = NumElements; i != e; ++i) {
Constant *In = getAggregateConstantElement(Init,
@@ -614,17 +615,11 @@
if (Constant *NewC = ConstantFoldInstruction(I)) {
I->replaceAllUsesWith(NewC);
- // Back up UI to avoid invalidating it!
- bool AtBegin = false;
- if (UI == V->use_begin())
- AtBegin = true;
- else
- --UI;
- I->eraseFromParent();
- if (AtBegin)
- UI = V->use_begin();
- else
+ // Advance UI to the next non-I use to avoid invalidating it!
+ // Instructions could multiply use V.
+ while (UI != E && *UI == I)
++UI;
+ I->eraseFromParent();
}
}
@@ -683,8 +678,7 @@
while (!GV->use_empty())
if (LoadInst *LI = dyn_cast<LoadInst>(GV->use_back())) {
while (!LI->use_empty()) {
- // FIXME: the iterator should expose a getUse() method.
- Use &LoadUse = *(const iplist<Use>::iterator&)LI->use_begin();
+ Use &LoadUse = LI->use_begin().getUse();
if (!isa<SetCondInst>(LoadUse.getUser()))
LoadUse = RepValue;
else {
More information about the llvm-commits
mailing list