[llvm-commits] [vmkit] r52462 - /vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Jun 18 08:32:49 PDT 2008
Author: geoffray
Date: Wed Jun 18 10:32:49 2008
New Revision: 52462
URL: http://llvm.org/viewvc/llvm-project?rev=52462&view=rev
Log:
Also remember which PHINodes we already visited.
Modified:
vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp
Modified: vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp?rev=52462&r1=52461&r2=52462&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp (original)
+++ vmkit/trunk/lib/Mvm/EscapeAnalysis.cpp Wed Jun 18 10:32:49 2008
@@ -64,7 +64,7 @@
-static bool escapes(Instruction* Ins, std::map<AllocaInst*, bool>& visited) {
+static bool escapes(Instruction* Ins, std::map<Instruction*, bool>& visited) {
for (Value::use_iterator I = Ins->use_begin(), E = Ins->use_end();
I != E; ++I) {
if (Instruction* II = dyn_cast<Instruction>(I)) {
@@ -93,7 +93,10 @@
}
else if (dyn_cast<ReturnInst>(II)) return true;
else if (dyn_cast<PHINode>(II)) {
- if (escapes(II, visited)) return true;
+ if (!visited[II]) {
+ visited[II] = true;
+ if (escapes(II, visited)) return true;
+ }
}
} else {
return true;
@@ -111,7 +114,7 @@
VirtualTable* Table = (VirtualTable*)C->getZExtValue();
// If the class has a finalize method, do not stack allocate the object
if (!((void**)Table)[0]) {
- std::map<AllocaInst*, bool> visited;
+ std::map<Instruction*, bool> visited;
if (!(escapes(Alloc, visited))) {
AllocaInst* AI = new AllocaInst(Type::Int8Ty, Size, "", Alloc);
BitCastInst* BI = new BitCastInst(AI, Alloc->getType(), "", Alloc);
More information about the llvm-commits
mailing list