aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-16 16:01:18 +0000
committerDan Gohman <gohman@apple.com>2010-04-16 16:01:18 +0000
commitb391bb8947e9703e4803d50f24df6caaa8bb0cc9 (patch)
treeb0cba8da285159033f107ca19aa36b3008735770 /lib/Analysis/InlineCost.cpp
parentea25b48af33be42e19236d8eac26bd42b45bcc1b (diff)
Disable inlining of recursive calls. It can complicate tailcallelim and
dependent analyses, and increase code size, so doing it profitably would require more complex heuristics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InlineCost.cpp')
-rw-r--r--lib/Analysis/InlineCost.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index 6650a680f1..b3ce42c859 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -263,6 +263,13 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS,
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.