revert r102831. We already delete dead readonly calls in
authorChris Lattner <sabre@nondot.org>
Sat, 1 May 2010 17:19:38 +0000 (17:19 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 1 May 2010 17:19:38 +0000 (17:19 +0000)
other places, killing a valid transformation is not the right
answer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/Inliner.cpp
test/Transforms/Inline/delete-call.ll

index 875c4fd70384d72440a911dfb31c6826cd30db85..b785bb0a9390e58e1e11d027b7fb1bc44faa3eeb 100644 (file)
@@ -33,8 +33,7 @@
 using namespace llvm;
 
 STATISTIC(NumInlined, "Number of functions inlined");
-// FIXME: Uncomment once call deletion xform is made safe
-// STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined");
+STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined");
 STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
 STATISTIC(NumMergedAllocas, "Number of allocas merged together");
 
@@ -383,9 +382,6 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
       Function *Caller = CS.getCaller();
       Function *Callee = CS.getCalledFunction();
 
-      // FIXME: This transformation is not legal unless we can prove
-      // that the callee always terminates.
-#if 0
       // If this call site is dead and it is to a readonly function, we should
       // just delete the call instead of trying to inline it, regardless of
       // size.  This happens because IPSCCP propagates the result out of the
@@ -400,7 +396,6 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
         // Update the cached cost info with the missing call
         growCachedCostInfo(Caller, NULL);
       } else {
-#endif
         // We can only inline direct calls to non-declarations.
         if (Callee == 0 || Callee->isDeclaration()) continue;
       
@@ -442,9 +437,7 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
         
         // Update the cached cost info with the inlined call.
         growCachedCostInfo(Caller, Callee);
-#if 0
       }
-#endif
       
       // If we inlined or deleted the last possible call site to the function,
       // delete the function body now.
index 7775aa383fc9e814eb76c3fabdb2f5d916c87e16..3505608b828335fe84e9da710751e3e17be2ecce 100644 (file)
@@ -1,6 +1,6 @@
 ; RUN: opt %s -S  -inline -functionattrs -stats |& grep {Number of call sites deleted, not inlined}
 ; RUN: opt %s -S  -inline -stats |& grep {Number of functions inlined}
-; XFAIL: *
+
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
 target triple = "i386-apple-darwin9.8"