summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2017-11-02 22:26:51 +0000
committerHiroshi Yamauchi <yamauchi@google.com>2017-11-02 22:26:51 +0000
commitdd33e177dd838793692d7a291dc5552e30642842 (patch)
tree958785f8097f8e508a3cab45b1bd18111a725bd4 /docs
parentda35e5e8bec2e0110f896b4ef677445187c7ab42 (diff)
Irreducible loop metadata for more accurate block frequency under PGO.
Summary: Currently the block frequency analysis is an approximation for irreducible loops. The new irreducible loop metadata is used to annotate the irreducible loop headers with their header weights based on the PGO profile (currently this is approximated to be evenly weighted) and to help improve the accuracy of the block frequency analysis for irreducible loops. This patch is a basic support for this. Reviewers: davidxl Reviewed By: davidxl Subscribers: mehdi_amini, llvm-commits, eraman Differential Revision: https://reviews.llvm.org/D39028 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r--docs/LangRef.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst
index 9d910568bd5..6823fe5fcd7 100644
--- a/docs/LangRef.rst
+++ b/docs/LangRef.rst
@@ -5194,6 +5194,29 @@ the loop identifier metadata node directly:
!1 = !{!1} ; an identifier for the inner loop
!2 = !{!2} ; an identifier for the outer loop
+'``irr_loop``' Metadata
+^^^^^^^^^^^^^^^^^^^^^^^
+
+``irr_loop`` metadata may be attached to the terminator instruction of a basic
+block that's an irreducible loop header (note that an irreducible loop has more
+than once header basic blocks.) If ``irr_loop`` metadata is attached to the
+terminator instruction of a basic block that is not really an irreducible loop
+header, the behavior is undefined. The intent of this metadata is to improve the
+accuracy of the block frequency propagation. For example, in the code below, the
+block ``header0`` may have a loop header weight (relative to the other headers of
+the irreducible loop) of 100:
+
+.. code-block:: llvm
+
+ header0:
+ ...
+ br i1 %cmp, label %t1, label %t2, !irr_loop !0
+
+ ...
+ !0 = !{"loop_header_weight", i64 100}
+
+Irreducible loop header weights are typically based on profile data.
+
'``invariant.group``' Metadata
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^