<div dir="ltr">Actually looking at this patch, why not do this in the pass which adds function attributes by adding the cold attribute to error reporting library functions? Then the existing BPI code will trigger.<div><br>
</div><div>Also, I would sink the logic for determining if a particular library call to write to a stream is writing to 'stderr' into TargetLibraryInfo itself. Essentially, make a boolean query for 'isLikelyErrorReportingFn' or something.</div>
<div><br></div><div>Finally, why not also bias against write() calls with a numeric argument pointing to the typical stderr file descriptor?</div><div><br></div><div>With all of these heuristics, it would be useful to clarify that this isn't a *guarantee* that this is an error reporting function (you can rearrange stderr if you want, etc), but it's a strong signal that we can do stuff like synthesizing the cold attribute from.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Oct 27, 2013 at 4:23 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
BranchProbabilityInfo, which is used by the SDAG builder to assign branch weights, contains a number of well-known heuristics for statically predicting branch outcomes. One of these heuristics assigns low probabilities to paths post-dominated by cold calls (calls with the cold attribute). This patch enhances that heuristic to consider 'error reporting' calls to also be cold. An 'error reporting' call is a call to perror or a call to fprintf, fwrite, etc. where stderr is the stream.<br>

<br>
This is one of the suggested heuristics from:<br>
<a href="http://impact.crhc.illinois.edu/shared/papers/pact-98-branchpred.pdf" target="_blank">http://impact.crhc.illinois.edu/shared/papers/pact-98-branchpred.pdf</a><br>
<br>
I don't see any significant test-suite changes.<br>
<br>
Please review.<br>
<br>
Thanks again,<br>
Hal<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory</font></span><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>