Add 'cold' attribute to functions
Diego Novillo
dnovillo at google.com
Wed May 15 11:41:57 PDT 2013
On 2013-05-15 12:06 , Chandler Carruth wrote:
>
>
>
> Should I add the following changes as well? There don't seem to
> be tests for these files (nothing I could find in a quick search,
> anyway).
>
>
> I would add them, but maybe in a separate commit.
Will do.
> Main patch is attached. OK to commit?
>
>
> LGTM. Check w/ Duncan though since he looked at one version of it.
Sure. Duncan, please let me know if that extra test case I added
addresses your concerns. Note that I could only address the analysis
part. I believe codegen is not using this information properly yet (I
left a TODO in the test case).
>
> I'm not sure what the best way to phrase all of this is though...
How about something like this:
diff --git a/docs/LangRef.rst b/docs/LangRef.rst
index 1c0864d..77ef016 100644
--- a/docs/LangRef.rst
+++ b/docs/LangRef.rst
@@ -808,10 +808,15 @@ example:
this function into callers whenever possible, ignoring any active
inlining size threshold for this caller.
``cold``
- This attribute indicates that this function is not called
- frequently. When computing edge weights, basic blocks
- post-dominated by a cold function are also considered to be cold;
- and, thus, given low weight.
+ This attribute indicates that this function is unlikely to be
+ executed. It indicates that performance of the code in paths
+ coming out and leading into that function call should not be a
+ concern. Paths leading to the cold call are marked as unlikely by
+ the branch prediction analysis. Example of functions that are
+ useful to mark cold are functions handling unlikely conditions,
+ such as fatal errors. This will cause the optimizer to place more
+ emphasis on optimizing the hot paths in the code (e.g., code
+ layout will move cold code sections to the bottom).
``nonlazybind``
This attribute suppresses lazy symbol binding for the function. This
may make calls to the function faster, at the cost of extra program
Diego.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130515/1c5a6e2b/attachment.html>
More information about the llvm-commits
mailing list