[PATCH] Add loop unroll pragma support
Mark Heffernan
meheff at google.com
Tue Jun 10 11:54:32 PDT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4089.10288.patch
Type: text/x-patch
Size: 26497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140610/f905c6d4/attachment.bin>
More information about the cfe-commits
mailing list