[PATCH] Update documentation for unroll pragmas on loops with runtime trip counts

Mark Heffernan meheff at google.com
Tue Jun 30 16:55:52 PDT 2015


Hi hfinkel, broune,

This change updates the documentation for the loop unrolling pragma behavior
change in http://reviews.llvm.org/D10854 Specifically, with that change
"#pragma unroll" enables unrolling of loops with a runtime trip count.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10857

Files:
  docs/LanguageExtensions.rst
  include/clang/Basic/AttrDocs.td

Index: docs/LanguageExtensions.rst
===================================================================
--- docs/LanguageExtensions.rst
+++ docs/LanguageExtensions.rst
@@ -1991,10 +1991,12 @@
 reduces the trip count.
 
 If ``unroll(full)`` is specified the unroller will attempt to fully unroll the
-loop if the trip count is known at compile time. If the loop count is not known
-or the fully unrolled code size is greater than the limit specified by the
-`-pragma-unroll-threshold` command line option the loop will be partially
-unrolled subject to the same limit.
+loop if the trip count is known at compile time. If the fully unrolled code size
+is greater than the limit specified by the `-pragma-unroll-threshold` command
+line option the loop will be partially unrolled subject to the same limit.  If
+the loop trip count is unknown at compile time the unroller tries to unroll the
+loop by a power-of-two factor subject to an unrolled size limit specified by
+the `-unroll-threshold` command line option.
 
 .. code-block:: c++
 
Index: include/clang/Basic/AttrDocs.td
===================================================================
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -1323,8 +1323,11 @@
 ``#pragma nounroll``. The pragma is placed immediately before a for, while,
 do-while, or c++11 range-based for loop.
 
-Specifying ``#pragma unroll`` without a parameter directs the loop unroller to
-attempt to fully unroll the loop if the trip count is known at compile time:
+Specifying ``#pragma unroll`` without a parameter directs the loop
+unroller to attempt to fully unroll the loop if the trip count is
+known at compile time. If the trip count is not known at compile time
+the loop unroller tries to unroll the loop by a power-of-two factor
+subject to a limit on unrolled code size.
 
 .. code-block:: c++

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10857.28830.patch
Type: text/x-patch
Size: 1862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150630/7233f097/attachment.bin>


More information about the llvm-commits mailing list