#pragma clang loop - documentation

Tyler Nowicki tnowicki at apple.com
Wed Jun 11 14:54:23 PDT 2014


Hi Dmitri,

I think the optimization hint docs should be high-level, and the Rpass diagnostics should be used to determine if/why an optimization is not being applied. What do you think about adding this paragraph to the language extensions guide to clarify this?

If an optimization cannot be applied its hints will be ignored. For example, the
hint ``vectorize_width(4)`` is ignored if the loop is not proven safe to
vectorize. To identify and diagnose optimization issues use `-Rpass`,
`-Rpass-missed`, and `-Rpass-analysis` command line options. See the user guide
for details.

Tyler

On Jun 11, 2014, at 8:06 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> On Wed, Jun 11, 2014 at 2:20 AM, Tyler Nowicki <tnowicki at apple.com> wrote:
>> Hi,
>> 
>> Here is a patch for the loop hints documentation. I’m not exactly sure if I wrote the attribute documentation correctly. If I missed something please let me know.
> 
>> +Extensions for loop hint optimizations
>> +======================================
>> +
>> +The ``#pragma clang loop`` directive is used to specify hints for optimizing the
>> +subsequent for, while, do-while, or c++11 range-based for loop. The directive
>> +provides options for controlling vectorization, interleaving, and unrolling.
> 
> This documentation describes syntax and the high-level effect of the
> pragma, but it does not explain what are the semantic constraints on
> the loop.  Users would want to know when it is valid to apply the
> pragma, and the documentation does not explain that.
> 
> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140611/b3178f56/attachment.html>


More information about the cfe-commits mailing list