[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Sep 15 10:25:00 PDT 2006
Changes in directory llvm/lib/Transforms/IPO:
ArgumentPromotion.cpp updated: 1.24 -> 1.25
---
Log message:
revert previous two patches. They cause miscompilation of MultiSource/Applications/Burg
---
Diffs of the changes: (+1 -35)
ArgumentPromotion.cpp | 36 +-----------------------------------
1 files changed, 1 insertion(+), 35 deletions(-)
Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.24 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.24 Fri Sep 15 00:22:51 2006
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Fri Sep 15 12:24:45 2006
@@ -179,40 +179,6 @@
return true;
}
-/// AccessOccursOnPath - Returns true if and only if a load or GEP instruction
-/// on Pointer occurs in Path, or in every control-flow path that succeeds it.
-bool AccessOccursOnPath(Argument* Arg) {
- std::vector<BasicBlock*> Worklist;
- Worklist.push_back(Arg->getParent()->begin());
-
- std::set<BasicBlock*> Visited;
-
- while (!Worklist.empty()) {
- BasicBlock* BB = Worklist.back();
- Worklist.pop_back();
- Visited.insert(BB);
-
- bool ContainsAccess = false;
- for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- if (isa<LoadInst>(I) || isa<GetElementPtrInst>(I)) {
- ContainsAccess = true;
- break;
- }
-
- if (ContainsAccess) continue;
-
- TerminatorInst* TI = BB->getTerminator();
- if (isa<BranchInst>(TI) || isa<SwitchInst>(TI)) {
- for (unsigned i = 0; i < TI->getNumSuccessors(); ++i)
- if (!Visited.count(TI->getSuccessor(i)))
- Worklist.push_back(TI->getSuccessor(i));
- } else {
- return false;
- }
- }
-
- return true;
-}
/// isSafeToPromoteArgument - As you might guess from the name of this method,
/// it checks to see if it is both safe and useful to promote the argument.
@@ -286,7 +252,7 @@
// of the pointer in the entry block of the function) or if we can prove that
// all pointers passed in are always to legal locations (for example, no null
// pointers are passed in, no pointers to free'd memory, etc).
- if (!AccessOccursOnPath(Arg) && !AllCalleesPassInValidPointerForArgument(Arg))
+ if (!HasLoadInEntryBlock && !AllCalleesPassInValidPointerForArgument(Arg))
return false; // Cannot prove that this is safe!!
// Okay, now we know that the argument is only used by load instructions and
More information about the llvm-commits
mailing list