[llvm-commits] [llvm] r101969 - in /llvm/trunk: lib/Analysis/InlineCost.cpp test/Transforms/Inline/tail-recursion.ll
Dan Gohman
gohman at apple.com
Tue Apr 20 17:43:30 PDT 2010
Author: djg
Date: Tue Apr 20 19:43:30 2010
New Revision: 101969
URL: http://llvm.org/viewvc/llvm-project?rev=101969&view=rev
Log:
Revert r101471. For tight recursive functions which have multiple
recursive callsites, inlining can reduce the number of calls by
exponential factors, as it does in
MultiSource/Benchmarks/Olden/treeadd. More involved heuristics
will be needed.
Removed:
llvm/trunk/test/Transforms/Inline/tail-recursion.ll
Modified:
llvm/trunk/lib/Analysis/InlineCost.cpp
Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=101969&r1=101968&r2=101969&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Tue Apr 20 19:43:30 2010
@@ -263,13 +263,6 @@
CS.isNoInline())
return llvm::InlineCost::getNever();
- // Don't inline directly recursive calls, for now. Inlining a directly
- // recursive call is effectively unrolling a loop, so it calls for different
- // heuristics, which aren't implemented yet. Until then, err on the
- // conservative side.
- if (Callee == Caller)
- return llvm::InlineCost::getNever();
-
// InlineCost - This value measures how good of an inline candidate this call
// site is to inline. A lower inline cost make is more likely for the call to
// be inlined. This value may go negative.
Removed: llvm/trunk/test/Transforms/Inline/tail-recursion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/tail-recursion.ll?rev=101968&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Inline/tail-recursion.ll (original)
+++ llvm/trunk/test/Transforms/Inline/tail-recursion.ll (removed)
@@ -1,29 +0,0 @@
-; RUN: opt -inline -tailcallelim -indvars -loop-deletion -S < %s | FileCheck %s
-
-; Inline shouldn't inline foo into itself because it's a tailcallelim
-; candidate. Tailcallelim should convert the call into a loop. Indvars
-; should calculate the exit value, making the loop dead. Loop deletion
-; should delete the loop.
-; PR6842
-
-; CHECK: define i32 @bar() nounwind {
-; CHECK-NEXT: ret i32 10000
-; CHECK-NEXT: }
-
-define internal i32 @foo(i32 %x) nounwind {
- %i = add i32 %x, 1 ; <i32> [#uses=3]
- %a = icmp slt i32 %i, 10000 ; <i1> [#uses=1]
- br i1 %a, label %more, label %done
-
-done: ; preds = %0
- ret i32 %i
-
-more: ; preds = %0
- %z = tail call i32 @foo(i32 %i) ; <i32> [#uses=1]
- ret i32 %z
-}
-
-define i32 @bar() nounwind {
- %z = call i32 @foo(i32 0) ; <i32> [#uses=1]
- ret i32 %z
-}
More information about the llvm-commits
mailing list