[PATCH] Add loop unroll pragma support

Tyler Nowicki tnowicki at apple.com
Tue Jun 10 15:38:12 PDT 2014


Hi Mark,

That change sounds good! I was looking for a way to clean up that function. Glad you figured out a nice way of doing it.

LGTM

Tyler


On Jun 10, 2014, at 11:54 AM, Mark Heffernan <meheff at google.com> wrote:

> Hi TylerNowicki, eliben, aaron.ballman, rsmith,
> 
> Piggy-backing on the support for "#pragma clang loop vectorize..." which was added recently by Tyler.  This patch adds support for loop unrolling pragmas.  The pragmas must immediately precede a loop statement and take the following forms:
> 
> #pragma clang loop unroll(enable)  // unroll the loop completely
> #pragma clang loop unroll(disable)  // do not unroll the loop.
> #pragma clang loop unroll_count(N)  // unroll the loop N times
> 
> if both unroll(enable) and unroll_count(N) are specified then the unroll_count takes precedence (ie, unroll the loop N times).
> 
> Tyler, I changed the logic a bit in CheckForIncompatibleAttributes, specifically it now rejects any combination of the disable form of the pragma and the numeric form (eg, vectorize(disable) and vectorize_width(N)).  As a special case, it previously allowed this combination if the numeric value is 1.  The logic seems cleaner without that special case.  Lemme know if that's reasonable.
> 
> I'll be sending out a LLVM patch which consumes the generated metadata right after this.
> 
> http://reviews.llvm.org/D4089
> 
> Files:
>  include/clang/Basic/Attr.td
>  include/clang/Basic/DiagnosticParseKinds.td
>  lib/CodeGen/CGStmt.cpp
>  lib/Parse/ParsePragma.cpp
>  lib/Sema/SemaStmtAttr.cpp
>  test/CodeGen/pragma-loop.cpp
>  test/PCH/pragma-loop.cpp
>  test/Parser/pragma-loop.cpp
> <D4089.10288.patch>




More information about the cfe-commits mailing list