summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-18 21:34:16 +0000
committerChris Lattner <sabre@nondot.org>2004-07-18 21:34:16 +0000
commit8919cccc3db3290149e9b0f750f883ece3ba2bc7 (patch)
treefb5f06693bc3b732661c6d7369742f2be65afee5 /lib/Transforms
parent96940cb5223d8441f3710b75063a0ee5a3c824ed (diff)
downloadllvm-8919cccc3db3290149e9b0f750f883ece3ba2bc7.tar.gz
llvm-8919cccc3db3290149e9b0f750f883ece3ba2bc7.tar.bz2
llvm-8919cccc3db3290149e9b0f750f883ece3ba2bc7.tar.xz
Fix a performance regression from the CPR patch, simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14974 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/Inliner.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index bad8295ada..0a1bdea660 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -170,28 +170,20 @@ bool Inliner::doFinalization(CallGraph &CG) {
CallGraphNode *CGN = I->second;
Function *F = CGN ? CGN->getFunction() : 0;
- // If the only remaining use of the function is a dead constant
- // pointer ref, remove it.
- if (F && F->hasOneUse())
- if (Function *GV = dyn_cast<Function>(F->use_back()))
- if (GV->removeDeadConstantUsers()) {
- if (F->hasInternalLinkage()) {
- // There *MAY* be an edge from the external call node to this
- // function. If so, remove it.
- CallGraphNode *EN = CG.getExternalCallingNode();
- CallGraphNode::iterator I = std::find(EN->begin(), EN->end(), CGN);
- if (I != EN->end()) EN->removeCallEdgeTo(CGN);
- }
- }
+ // If the only remaining users of the function are dead constants,
+ // remove them.
+ if (F) F->removeDeadConstantUsers();
if (F && (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.
+ // function) remove the edge from the external node to the callee
+ // node.
if (!F->hasInternalLinkage())
CG.getExternalCallingNode()->removeCallEdgeTo(CGN);