From 4362387c74d8fb07ec914b3173abf834d639ff39 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 8 Jan 2009 21:45:23 +0000 Subject: Do not inline functions with (dynamic) alloca into functions that don't already have a (dynamic) alloca. Dynamic allocas cause inefficient codegen and we shouldn't propagate this (behavior follows gcc). Two existing tests assumed such inlining would be done; they are hacked by adding an alloca in the caller, preserving the point of the tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61946 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/Utils/InlineCost.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/llvm/Transforms/Utils/InlineCost.h b/include/llvm/Transforms/Utils/InlineCost.h index 1698a81..415fc1e 100644 --- a/include/llvm/Transforms/Utils/InlineCost.h +++ b/include/llvm/Transforms/Utils/InlineCost.h @@ -78,6 +78,9 @@ namespace llvm { /// caller. bool NeverInline; + /// usesDynamicAlloca - True if this function calls alloca (in the C sense). + bool usesDynamicAlloca; + /// NumInsts, NumBlocks - Keep track of how large each function is, which /// is used to estimate the code size cost of inlining it. unsigned NumInsts, NumBlocks; @@ -93,8 +96,8 @@ namespace llvm { /// entry here. std::vector ArgumentWeights; - FunctionInfo() : NeverInline(false), NumInsts(0), NumBlocks(0), - NumVectorInsts(0) {} + FunctionInfo() : NeverInline(false), usesDynamicAlloca(false), NumInsts(0), + NumBlocks(0), NumVectorInsts(0) {} /// analyzeFunction - Fill in the current structure with information /// gleaned from the specified function. -- cgit v1.1