<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:#1F497D}
.MsoChpDefault
        {}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">> after O1, sequential execution is a big impediment for optimizations, and
</p>
<p class="MsoNormal">> keeping the debug information valid after so many transformations might
</p>
<p class="MsoNormal">> pose a big penalty on the passes (time & memory). That was the whole
</p>
<p class="MsoNormal">> idea of metadata being a second-class citizen.<span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">I'm afraid I don't know much about how debug information is expressed, so this idea may</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">be nonsense.
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Is it possible for the debug information to mark all the instructions that arise from a
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">language statement as coming from that statement, even though the instructions may</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">be widely scattered? That in itself would be quite helpful. Instructions whose effects
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">are used in the logic from more than one statement would have to be included with</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">all those statement.
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">I felt the lack of something like this severely when digging out dozens of compiler bugs
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">on Microsoft's Itanium compiler, over a decade ago. That processor "naturally" mixed
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">instructions from many source statements, which prefigured this kind of problem.
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">I'm reasonably happy for debugging at high optimisation levels to be primarily done</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">with a disassembly listing rather than source code, provided I can get some idea of</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">which instructions come from which source statements, and which variables are being
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">accessed. The absence of debug information at that level tends to require going
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">through an entire function figuring out what every instruction does, and how it</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">relates to the source, which is rather time-consuming.
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">thanks,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Arial","sans-serif"; color:#1F497D">--
</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Arial","sans-serif"; color:#1F497D">John Dallman
</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> Renato Golin [mailto:renato.golin@linaro.org]
<br>
<b>Sent:</b> 07 June 2013 17:39<br>
<b>To:</b> Dallman, John<br>
<b>Cc:</b> LLVM Dev; Clang Dev<br>
<b>Subject:</b> Re: [cfe-dev] Meaning of LLVM optimization levels</span></p>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">On 7 June 2013 13:53, Dallman, John <<a href="mailto:john.dallman@siemens.com" target="_blank">john.dallman@siemens.com</a>> wrote:</p>
<div>
<div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0cm 0cm 0cm 6.0pt; margin-left:4.8pt; margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">It needs to be possible to debug code at any optimisation level.</span></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">Yes, I agree. But after O1, sequential execution is a big impediment for optimizations, and keeping the debug information valid after so many transformations might pose a big penalty on the passes (time & memory). That was the whole idea
 of metadata being a second-class citizen.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<blockquote style="border:none; border-left:solid #CCCCCC 1.0pt; padding:0cm 0cm 0cm 6.0pt; margin-left:4.8pt; margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Related to optimisation levels, it's quite helpful to have a way of controlling</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">optimisation on a function-by-function level. This is very useful when you're trying
</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">to work out where in a file with many functions an optimiser problem is happening;</span></p>
<p class="MsoNormal" style=""><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">it isn't foolproof, but it helps a lot.</span></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">There are already people working on that, and discussions on the list about this very topic. I agree that it would be extremely helpful for debugging large programs.</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">cheers,</p>
</div>
<div>
<p class="MsoNormal">--renato</p>
</div>
</div>
</div>
<p style="font-family:Arial; font-size:70%">-----------------<br>
Siemens Industry Software Limited is a limited company registered in England and Wales.<br>
Registered number: 3476850.<br>
Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD.
</p>
</body>
</html>