summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 6650a680f15..b3ce42c8597 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud