[llvm-commits] [llvm] r101565 - in /llvm/trunk: include/llvm/ADT/SCCIterator.h lib/Analysis/IPA/CallGraphSCCPass.cpp
Chris Lattner
sabre at nondot.org
Fri Apr 16 16:04:30 PDT 2010
Author: lattner
Date: Fri Apr 16 18:04:30 2010
New Revision: 101565
URL: http://llvm.org/viewvc/llvm-project?rev=101565&view=rev
Log:
building on the new CallGraphSCC abstraction, teach CallGraphSCCPassManager
to keep the node entries in scc_iterator up to date instead of dangling as
the SCC mutates.
This is a really terrible problem which was causing -g to affect codegen
because it would permute the memory image of the compiler process.
Thanks to Dale for expertly hunting it down.
Modified:
llvm/trunk/include/llvm/ADT/SCCIterator.h
llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
Modified: llvm/trunk/include/llvm/ADT/SCCIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SCCIterator.h?rev=101565&r1=101564&r2=101565&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SCCIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/SCCIterator.h Fri Apr 16 18:04:30 2010
@@ -183,6 +183,15 @@
return true;
return false;
}
+
+ /// ReplaceNode - This informs the scc_iterator that the specified Old node
+ /// has been deleted, and New is to be used in its place.
+ void ReplaceNode(NodeType *Old, NodeType *New) {
+ assert(!nodeVisitNumbers.count(New) && "New already in scc_iterator?");
+ assert(nodeVisitNumbers.count(Old) && "Old not in scc_iterator?");
+ nodeVisitNumbers[New] = nodeVisitNumbers[Old];
+ nodeVisitNumbers.erase(Old);
+ }
};
Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=101565&r1=101564&r2=101565&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Fri Apr 16 18:04:30 2010
@@ -417,6 +417,11 @@
Nodes[i] = New;
break;
}
+
+ // Update the active scc_iterator so that it doesn't contain dangling
+ // pointers to the old CallGraphNode.
+ scc_iterator<CallGraph*> *CGI = (scc_iterator<CallGraph*>*)Context;
+ CGI->ReplaceNode(Old, New);
}
More information about the llvm-commits
mailing list