From 92df026f0da91dc65ef6186e97ff87b1f53e8cd0 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Wed, 19 Sep 2012 08:08:04 +0000 Subject: Prevent inlining of callees which allocate lots of memory into a recursive caller. Example: void foo() { ... foo(); // I'm recursive! bar(); } bar() { int a[1000]; // large stack size } rdar://10853263 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164207 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/InlineCost.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h index 0cba135222..f8de533506 100644 --- a/include/llvm/Analysis/InlineCost.h +++ b/include/llvm/Analysis/InlineCost.h @@ -36,6 +36,9 @@ namespace llvm { const int LastCallToStaticBonus = -15000; const int ColdccPenalty = 2000; const int NoreturnPenalty = 10000; + /// Do not inline functions which allocate this many bytes on the stack + /// when the caller is recursive. + const int TotalAllocaSizeRecursiveCaller = 1024; } /// \brief Represents the cost of inlining a function. -- cgit v1.2.3-70-g09d2