From cbd056074cfcd79265ee1e04e83f347355e9ad61 Mon Sep 17 00:00:00 2001 From: Devang Patel <dpatel@apple.com> Date: Sat, 13 Mar 2010 00:10:20 +0000 Subject: Do not overestimate code size reduction in presense of debug info. Use CodeMetrics.analyzeBasicBlock() to estimate BB size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98401 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/InlineCost.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h index f0e97d7..ea76ec1 100644 --- a/include/llvm/Analysis/InlineCost.h +++ b/include/llvm/Analysis/InlineCost.h @@ -18,6 +18,7 @@ #include <climits> #include <map> #include <vector> +#include "llvm/ADT/DenseMap.h" namespace llvm { @@ -42,6 +43,9 @@ namespace llvm { /// is used to estimate the code size cost of inlining it. unsigned NumInsts, NumBlocks; + /// NumBBInsts - Keeps track of basic block code size estimates. + DenseMap<const BasicBlock *, unsigned> NumBBInsts; + /// NumCalls - Keep track of the number of calls to 'big' functions. unsigned NumCalls; @@ -148,7 +152,7 @@ namespace llvm { /// CountCodeReductionForConstant - Figure out an approximation for how /// many instructions will be constant folded if the specified value is /// constant. - unsigned CountCodeReductionForConstant(Value *V); + unsigned CountCodeReductionForConstant(Value *V, CodeMetrics &M); /// CountCodeReductionForAlloca - Figure out an approximation of how much /// smaller the function will be if it is inlined into a context where an -- cgit v1.1