summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-22 20:42:33 +0000
committerChris Lattner <sabre@nondot.org>2010-04-22 20:42:33 +0000
commitb61789d4dd851c2481d0ad95c7a710d567fb86f7 (patch)
tree0f8983157fdcfddefc05b6d3812af89e266a230c /lib
parentf8b99cb03bd2278328e995c4b8400a09f77ef19b (diff)
downloadllvm-b61789d4dd851c2481d0ad95c7a710d567fb86f7.tar.gz
llvm-b61789d4dd851c2481d0ad95c7a710d567fb86f7.tar.bz2
llvm-b61789d4dd851c2481d0ad95c7a710d567fb86f7.tar.xz
add a DEBUG call so that -debug lists when CGSCCPM iterates.
Fix RefreshCallGraph to use CGN->replaceCallEdge instead of hand rolling its own loop. replaceCallEdge properly maintains the reference counts of the nodes, fixing a crash exposed by the iterative callgraph stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index 6562e511e7..917aa990ce 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -278,13 +278,7 @@ bool CGPassManager::RefreshCallGraph(CallGraphSCC &CurSCC,
}
// Update the edge target in CGN.
- for (CallGraphNode::iterator I = CGN->begin(); ; ++I) {
- assert(I != CGN->end() && "Didn't find call entry");
- if (I->first == CS.getInstruction()) {
- I->second = CalleeNode;
- break;
- }
- }
+ CGN->replaceCallEdge(CS, CS, CalleeNode);
MadeChange = true;
continue;
}
@@ -422,6 +416,9 @@ bool CGPassManager::runOnModule(Module &M) {
unsigned Iteration = 0;
bool DevirtualizedCall = false;
do {
+ DEBUG(if (Iteration)
+ dbgs() << " SCCPASSMGR: Re-visiting SCC, iteration #"
+ << Iteration << '\n');
DevirtualizedCall = false;
Changed |= RunAllPassesOnSCC(CurSCC, CG, DevirtualizedCall);
} while (Iteration++ < MaxIterations && DevirtualizedCall);