aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-09-18 21:37:03 +0000
committerChris Lattner <sabre@nondot.org>2004-09-18 21:37:03 +0000
commit0c0aa711b8a0550c21f032125c4663ff45864f81 (patch)
treeb1c028e72e7a45fa31f53122422e7d82d3e7a15f
parentcd382a3725e46a41c6dfb923cd1ee295fa0461aa (diff)
downloadexternal_llvm-0c0aa711b8a0550c21f032125c4663ff45864f81.zip
external_llvm-0c0aa711b8a0550c21f032125c4663ff45864f81.tar.gz
external_llvm-0c0aa711b8a0550c21f032125c4663ff45864f81.tar.bz2
Fix the inliner to always delete any edges from the external call node to
a function being deleted. Due to optimizations done while inlining, there can be edges from the external call node to a function node that were not apparent any longer. This fixes the compiler crash while compiling 175.vpr git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16399 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/Inliner.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 86d343a..9c8d7aa 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -168,22 +168,21 @@ bool Inliner::doFinalization(CallGraph &CG) {
for (CallGraph::iterator I = CG.begin(), E = CG.end(); I != E; ++I) {
CallGraphNode *CGN = I->second;
if (Function *F = CGN ? CGN->getFunction() : 0) {
- // If the only remaining users of the function are dead constants,
- // remove them.
- bool HadDeadConstantUsers = !F->use_empty();
+ // If the only remaining users of the function are dead constants, remove
+ // them.
F->removeDeadConstantUsers();
if ((F->hasLinkOnceLinkage() || F->hasInternalLinkage()) &&
F->use_empty()) {
+
// Remove any call graph edges from the function to its callees.
while (CGN->begin() != CGN->end())
CGN->removeCallEdgeTo(*(CGN->end()-1));
- // If the function has external linkage (basically if it's a linkonce
- // function) remove the edge from the external node to the callee
- // node.
- if (!F->hasInternalLinkage() || HadDeadConstantUsers)
- CG.getExternalCallingNode()->removeCallEdgeTo(CGN);
+ // Remove any edges from the external node to the function's call graph
+ // node. These edges might have been made irrelegant due to
+ // optimization of the program.
+ CG.getExternalCallingNode()->removeAnyCallEdgeTo(CGN);
// Removing the node for callee from the call graph and delete it.
FunctionsToRemove.insert(CGN);