<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
This would be really nice to have. There will be lots of details to
work out - Hal already raised one of the more important ones - but
I'd be very happy to see LLVM grow in this direction. Thanks for
working on this.<br>
<br>
Philip<br>
<br>
<div class="moz-cite-prefix">On 10/22/2015 11:25 AM, Cox, Robert via
llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:1037A0647E0CB3498EA4C28DCC4E856B40DA39A9@ORSMSX113.amr.corp.intel.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><b>RFC: Inlining Report <o:p></o:p></b></p>
<p class="MsoNormal"><b><span style="color:#1F497D"><o:p> </o:p></span></b></p>
<p class="MsoNormal"><b>Motivation <o:p></o:p></b></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Making good
inlining choices while optimizing an application is often
key to achieving optimal performance. While the compiler’s
default inlining heuristics sometimes provide great
out-of-box results, optimal performance is sometimes
achieved only after varying the settings of certain compiler
options related to inlining or adding “always_inline” or
“noinline” attributes to certain functions.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Before we can
determine how we need change the compiler’s inlining choices
to get better performance for an application, we need to
have a clear picture of the compiler’s inlining choices and
what motivated them. Many compilers like LLVM and GCC
provide <b>informational notes </b>when a function is
inlined, but these notes provide only a “blow by blow”
description of what the compiler did, rather than a high
level illustration of the result. This high level picture
can be provided by an <b>inlining report. <o:p></o:p></b></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Over the years,
I’ve worked with several compilers that provide inlining
reports, and I can attest that the customers using those
compilers have found them to be invaluable tool in
investigating and improving their applications’
performance. In addition, the inlining report can be used
by compiler developers to visualize and improve the
compiler’s default heuristics and option values.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">For these
reasons, I’d like to contribute code to LLVM to generate an
inlining report as part of the inliner.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b>Description <o:p></o:p></b></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">The inlining
report I am proposing contains the following information:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in"><span
style="color:black">(1)</span><span
style="font-size:7.0pt;font-family:"Times New
Roman","serif";color:black">
</span><span style="color:black">The values of the principle
threshold options which affect how much inlining is done
under various circumstances<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in"><span
style="color:black">(2)</span><span
style="font-size:7.0pt;font-family:"Times New
Roman","serif";color:black">
</span><span style="color:black">Whether each function is
compiled or has been eliminated by dead static function
elimination.<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in"><span
style="color:black">(3)</span><span
style="font-size:7.0pt;font-family:"Times New
Roman","serif";color:black">
</span><span style="color:black">For each function, the call
sites that were and were not inlined. Since inlining a call
site can expose other call sites for inlining, the inlining
report also reports on whether these exposed call sites have
been inlined or not. This information is presented in
hierarchical manner.<o:p></o:p></span></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in"><span
style="color:black">(4)</span><span
style="font-size:7.0pt;font-family:"Times New
Roman","serif";color:black">
</span><span style="color:black">For each call site, we
include the principle reason the call site was or was not
inlined, together with any cost vs . threshold computation
that was done.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><b>High Level Design <o:p></o:p></b></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">The inline report is created if the option
–inline-report=X is passed on command line with a positive
integer value of X. If X is 0, or this option is not
specified, the Inliner does not create or perform any
operations on the inline report, and there is no compile time
overhead. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Three main classes are used to implement
the inline report:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><i>class InlineReportCallSite <o:p></o:p></i></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This class contains the inlining report
information specific to a particular CallSite CS, including:
<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(1)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>A bool indicating whether or not the CallSite was or
was not inlined <o:p>
</o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(2)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>An inlining reason indicating why the CallSite was or
was not inlined <o:p>
</o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(3)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>The inlining cost, outer inlining cost, and threshold
values used in calculating the profitability of inlining
<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(4)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>A vector of InlineReportCallSite*, each of which points
to an InlineReportCallSite for a CallSite exposed when CS was
inlined. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><i>class InlineReportFunction <o:p></o:p></i></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This class contains the inlining report
information specific to a particular Function F in the call
graph, including:
<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(1)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>A bool indicating whether the function has been dead
static eliminated. <o:p>
</o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(2)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>A vector of call InlineReportCallSite*, each of which
points to an InlineReportCallSite for a CallSite that appeared
in F before any inlining was applied.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><i>class InlineReport <o:p></o:p></i></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The main class which summarizes the high
level information in the inline report, including:
<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(1)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>The values of the inlining threshold options<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(2)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>The “level” of the inlining report, which is a bit
vector of feature options. For example, whether to print
external functions and intrinsics, whether to print the
inlining reasons, etc.
<o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(3)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>A map MF from each Function* to InlineReportFunction* <o:p></o:p></p>
<p class="MsoListParagraph"
style="margin-left:.75in;text-indent:-.25in">(4)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>A map MCS from each CallSite* to InlineReportCallSite*
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">In addition, the class InlineCost (from
InlineCost.h) is augmented to include the primary reason a
call site was inlined.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The class Inliner has been augmented with
an InlineReport, which is created when an Inliner is
constructed. The InlineReport is updated using calls to the
member functions of these three classes in Inliner::runOnSCC()
and the functions called by it. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Before any inlining is done in a particular
call to runOnSCC(), the map MF is updated so that each
Function (caller or callee) that will be examined for inlining
has a corresponding InlineReportFunction in the map. (The map
MCS is also updated in a similar way, but only when a Function
is actually inlined.) <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The Inliner determines if a CallSite should
be inlined by first calling Inliner::ShouldInline(). This
calls getInlineCost() which returns an InlineCost, which now
includes the reason the call site should or should not be
inlined. This reason, as well and costs and threshold from
the InlineCost are stored in the InlineReportCallSite for the
CallSite.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Then Inliner calls the static function
InlineCallPossible(). If the inlining was not performed, the
reason for not inlining is recorded in the
InlineReportCallSite corresponding to the CallSite. If the
inlining was performed, the corresponding InlineReportCallSite
is marked as inlined, and it is populated with the
InlineReportCallSites corresponding to the newly exposed
CallSites that were created during the inlining.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The InlineReport is printed during the call
to Inliner::doFinalization().
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Since the compiler can run any number of
optimizations between two successive calls to runOnSCC(), the
Instructions corresponding to CallSites can be deleted by the
optimizations. Callbacks are used to mark the corresponding
InlineReportCallSites as deleted when this happens. <o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="color:black">Example <o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:black">Here is an
example of abbreviated inlining report that is generated in
my locally modified copy of the LLVM sources. I generated
this by compiling the file bzip2.c from the spec 2006
benchmark 401.bzip. (For the sake of brevity, I didn’t
include all of the report</span>. Omitted parts are
indicated by …. in the report.)
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>---- Begin Inlining Report ----<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>Option Values:<o:p></o:p></b></p>
<p class="MsoNormal"><b> inline-threshold: 225<o:p></o:p></b></p>
<p class="MsoNormal"><b> inlinehint-threshold: 325<o:p></o:p></b></p>
<p class="MsoNormal"><b> inlinecold-threshold: 225<o:p></o:p></b></p>
<p class="MsoNormal"><b> inlineoptsize-threshold: 15<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>COMPILE FUNC: fopen_output_safely<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: open<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fdopen<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: close<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>DEAD STATIC FUNC: setExit<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>DEAD STATIC FUNC: copyFileName<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>DEAD STATIC FUNC: showFileNames<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>DEAD STATIC FUNC: stat<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>….<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>COMPILE FUNC: cleanUpAndFail<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> llvm.lifetime.start<o:p></o:p></b></p>
<p class="MsoNormal"><b> [[Callee is intrinsic]]<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: stat (35<=487)<o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Callee is single basic
block>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: __xstat<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fclose<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: remove<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: setExit (15<=225)<o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Inlining is
profitable>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: exit<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>….<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>COMPILE FUNC: outOfMemory<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: showFileNames
(70<=225)<o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Inlining is
profitable>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> cleanUpAndFail<o:p></o:p></b></p>
<p class="MsoNormal"><b> [[Callee is noreturn]]<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>….<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>COMPILE FUNC: snocString<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: mkCell (-14920<=225)<o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Callee has single callsite
and local linkage>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: myMalloc
(70<=225)<o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Inlining is
profitable>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: malloc<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> outOfMemory<o:p></o:p></b></p>
<p class="MsoNormal"><b> [[Callee is noreturn]]<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: strlen<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: myMalloc
(-14925<=225)<o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Callee has single callsite
and local linkage>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: malloc<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> outOfMemory<o:p></o:p></b></p>
<p class="MsoNormal"><b> [[Callee is noreturn]]<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: strcpy<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> snocString<o:p></o:p></b></p>
<p class="MsoNormal"><b> [[Callee is never inline]]<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>…..<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b>---- End Inlining Report ------<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">Here is an explanation of some of the
features:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in">(1)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>Option values<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">Option
Values:<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">
inline-threshold: 225<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">
inlinehint-threshold: 325<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">
inlinecold-threshold: 225<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">
inlineoptsize-threshold: 15</span><o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">The report begins with a list of the most
relevant option values to inlining.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in">(2)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>Compiled and dead functions<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">COMPILE
FUNC: fopen_output_safely</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: open<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fdopen<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: close<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow">DEAD STATIC
FUNC: setExit</span><o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">Functions in the file are identified as
either being compiled or eliminated by dead static function
elimination.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in">(3)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>External function calls <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>COMPILE FUNC: fopen_output_safely<o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">->
EXTERN: open<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow"> ->
EXTERN: fdopen<o:p></o:p></span></b></p>
<p class="MsoNormal"><b><span
style="background:yellow;mso-highlight:yellow"> ->
EXTERN: close</span><o:p></o:p></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Calls to externally defined functions are
indicated by the word EXTERN. These lines can optionally be
omitted.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in">(4)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>Inlining and nesting <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>COMPILE FUNC: snocString<o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">->
INLINE: mkCell (-14920<=225)</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Callee has single callsite
and local linkage>><o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">
-> INLINE: myMalloc (70<=225)</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> <<Inlining is
profitable>><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: malloc<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">Inlined functions are marked INLINE. The
inlining of a function within other inlined functions is shown
clearly in the report using indentation.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in">(5)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>Reasons functions were and were not inlined<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>COMPILE FUNC: cleanUpAndFail<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> llvm.lifetime.start<o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">
[[Callee is intrinsic]]</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: stat <span
style="background:yellow;mso-highlight:yellow">
(35<=487)</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">
<<Callee is single basic block>></span><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: __xstat<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fclose<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: remove<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: setExit <span
style="background:yellow;mso-highlight:yellow">
(15<=225)</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">
<<Inlining is profitable>></span><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: exit<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">….<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>COMPILE FUNC: outOfMemory<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> INLINE: showFileNames <span
style="background:yellow;mso-highlight:yellow">
(70<=225)</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">
<<Inlining is profitable>></span><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> cleanUpAndFail<o:p></o:p></b></p>
<p class="MsoNormal"><b> <span
style="background:yellow;mso-highlight:yellow">
[[Callee is noreturn]]</span><o:p></o:p></b></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The principal reason a function was or was
not inlined can be optionally displayed in the report. The
reason a function was inlined is indicated in double angle
brackets << >>. The reason a function was not
inlined is indicated in double square brackets [[ ]]. When a
comparison of the cost and threshold was used to determine if
the function should be inlined, the comparison done is
given. (Since intrinsics are never inlined, information
about them can be suppressed in the report.) The reasons for
or for not inlining can optionally be displayed on the same
line as the function considered for inlining for easy analysis
using grep, awk, etc.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-.25in">(6)<span
style="font-size:7.0pt;font-family:"Times New
Roman","serif"">
</span>Line and column info <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>COMPILE FUNC: outOfMemory<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> EXTERN: fprintf <span
style="background:yellow;mso-highlight:yellow">bzip2.c(1016,4)</span><o:p></o:p></b></p>
<p class="MsoNormal"><b> -> showFileNames <span
style="background:yellow;mso-highlight:yellow">bzip2.c(1019,4)</span>
[[Callee is never inline]]<o:p></o:p></b></p>
<p class="MsoNormal"><b> -> cleanUpAndFail <span
style="background:yellow;mso-highlight:yellow">bzip2.c(1020,4)</span>
[[Callee is never inline]]<o:p></o:p></b></p>
<p class="MsoNormal"><b><o:p> </o:p></b></p>
<p class="MsoNormal">Optionally, file, line, and column info can
be provided for call sites if source position information is
present (using –g or
<o:p></o:p></p>
<p class="MsoNormal">–gline-tables-only). <o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">I would appreciate any comments you have on
whether you support the inclusion of an inline report in LLVM,
the form and features I have outlined above, and your thoughts
on the high level design.
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">Thank you in advance for your comments,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Robert Cox<o:p></o:p></p>
<p class="MsoNormal"><a moz-do-not-send="true"
href="mailto:robert.cox@intel.com"><span
style="color:windowtext;text-decoration:none">robert.cox@intel.com</span></a>
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>