<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (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;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:Calibri;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Calibri;
color:windowtext;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0in;
margin-bottom:.0001pt;
font-size:13.5pt;
font-family:Menlo;}
span.s1
{mso-style-name:s1;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.msoIns
{mso-style-type:export-only;
mso-style-name:"";
text-decoration:underline;
color:teal;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:Calibri;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="p1"><span class="s1"><span style="font-size:10.5pt">Hi,<o:p></o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt"><o:p> </o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">I need to measure the memory usage of opt passes and have some questions in this regard.<o:p></o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt"><o:p> </o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">First off, this does not really do anything;
</span></span><span style="font-size:10.5pt">is it a bug?<span class="s1"><o:p></o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt"><o:p> </o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">$ clang -mllvm -time-passes -mllvm -track-memory -c -O3 ./p0.c</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo">So, instead, I do:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo"><o:p> </o:p></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">$ clang -emit-llvm -O3 -c ./p0.c</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">$ opt -time-passes -track-memory ./p0.bc -O3 -o p0.O3.bc 2> p0.O3.txt</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo"><o:p> </o:p></span></p>
<p class="p1"><span style="font-size:10.5pt">Which gets me the report I am looking for, however, I do not understand why there are negative numbers in the Mem column.<o:p></o:p></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt"><o:p> </o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">===-------------------------------------------------------------------------===</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">... Pass execution timing report ...</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">===-------------------------------------------------------------------------===</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt"><o:p> </o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">…<o:p></o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt"><o:p> </o:p></span></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">---User Time--- </span>
</span><span class="apple-converted-space"><span style="font-size:10.5pt"> </span>
</span><span class="s1"><span style="font-size:10.5pt">--User+System-- </span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">---Wall Time---</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">---Mem---</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">--- Name ---<o:p></o:p></span></span></p>
<p class="p1"><span class="apple-converted-space"><span style="font-size:10.5pt"></span></span><span class="s1"><span style="font-size:10.5pt">0.0010 ( 33.3%)
</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">0.0010 ( 33.3%) </span>
</span><span class="apple-converted-space"><span style="font-size:10.5pt"> </span>
</span><span class="s1"><span style="font-size:10.5pt">0.0012 ( 41.2%) </span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">324576</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">Simplify the CFG</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span class="s1"><span style="font-size:10.5pt">…<o:p></o:p></span></span></p>
<p class="p1"><span class="apple-converted-space"><span style="font-size:10.5pt"> </span></span><span class="s1"><span style="font-size:10.5pt">0.0000 (</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">0.0%) </span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">0.0000 (</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">0.0%) </span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">0.0000 (</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">0.4%)</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">-7184</span></span><span class="apple-converted-space"><span style="font-size:10.5pt">
</span></span><span class="s1"><span style="font-size:10.5pt">Scalar Evolution Analysis</span></span><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span style="font-size:10.5pt">…<o:p></o:p></span></p>
<p class="p1"><span style="font-size:10.5pt"><o:p></o:p></span></p>
<p class="p1"><span style="font-size:10.5pt"> Also, what are the units for the numbers in the Mem column?<o:p></o:p></span></p>
<p class="p1"><span style="font-size:10.5pt"><o:p> </o:p></span></p>
<p class="p1"><span style="font-size:10.5pt">I found the <span class="s1">-ftime-report option to clang; is there a similar way to request memory usage tracking of opt passes from clang?</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo">Thank you,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo">Anmol.<o:p></o:p></span></p>
</div>
</body>
</html>