[llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Sep 18 14:37:14 PDT 2004
Changes in directory llvm/lib/Transforms/IPO:
Inliner.cpp updated: 1.22 -> 1.23
---
Log message:
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
---
Diffs of the changes: (+7 -8)
Index: llvm/lib/Transforms/IPO/Inliner.cpp
diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.22 llvm/lib/Transforms/IPO/Inliner.cpp:1.23
--- llvm/lib/Transforms/IPO/Inliner.cpp:1.22 Wed Sep 1 17:55:36 2004
+++ llvm/lib/Transforms/IPO/Inliner.cpp Sat Sep 18 16:37:03 2004
@@ -168,22 +168,21 @@
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);
More information about the llvm-commits
mailing list