<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr">On Sun, Dec 2, 2012 at 10:27 PM, Nadav Rotem <span dir="ltr"><<a href="mailto:nrotem@apple.com" target="_blank" class="cremed">nrotem@apple.com</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="im"><br><div><div>On Dec 2, 2012, at 10:11 PM, Chris Lattner <<a href="mailto:clattner@apple.com" target="_blank" class="cremed">clattner@apple.com</a>> wrote:</div>
<br><blockquote type="cite"><span style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inline!important;float:none">3) Please change random parts of the compiler to use CodeMetrics, instead of scattering random checks for this attribute throughout the code.  Anything duplicating code and not using CodeMetrics is just plain incorrect.</span><br style="font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
</blockquote></div><div><br></div></div><div>One problem that we may run into when using CodeMetrics is compile time. In many cases we are looking for one particular trait and can exit as soon as we find it without having to scan the entire basic block or function.  For example, the jump threading pass stops scanning additional instructions as soon as it passes the cost threshold.</div>
</div></blockquote><div><br></div><div style>The inline cost analysis has similar problems, but compounded: we need to share the walk of instructions between cost computation and checking for incompatible patterns for inlining. </div>
<div style><br></div><div style>A long standing todo on my list has been to factor code metrics into an API that inline cost analysis could actually use without interfering with the instruction visit pattern of that cost analysis. I haven't had time to really make progress, in part because I don't (yet) have any particularly good ideas.... </div>
</div></div></div></div>