Change unroll metadata and unroll pragma names

Mark Heffernan meheff at google.com
Tue Jul 22 11:33:40 PDT 2014


This patch does some renaming of the metadata and unrolling pragma terms to
hopefully remove a source of confusion.  It was motivated the comments in
review: http://reviews.llvm.org/D4571.  Prior to this patch we have the
following pragma syntax and the corresponding metadata it generates:

#pragma clang loop unroll(enable)  => !{metadata
!"llvm.loop.unroll.enable", i1 true}
#pragma clang loop unroll(disable)  => !{metadata
!"llvm.loop.unroll.enable", i1 false}
#pragma clang loop unroll_count(N) => !{metadata !"llvm.loop.unroll.count",
i32 N}

#pragma unroll => !{metadata !"llvm.loop.unroll.enable", i1 true}
#pragma unroll N => !{metadata !"llvm.loop.unroll.count", i32 N}

Unroll disable and unroll count are pretty self explanatory.  The issue is
with "unroll(enable)".  "unroll(enable)" indicates to unroll the loop fully
which is a bit surprising.  It also is not clear whether you need
"unroll(enable)" when you specify "unroll_count(N)".  Both of these
potential sources of confusion are resolved with this patch which changes
the pragma and metadata to:

#pragma clang loop unroll(full)  => !{metadata !"llvm.loop.unroll.full"}
#pragma clang loop unroll(disable)  => !{metadata
!"llvm.loop.unroll.disable"}
#pragma clang loop unroll_count(N) => !{metadata !"llvm.loop.unroll.count",
i32 N}

#pragma unroll => !{metadata !"llvm.loop.unroll.full"}
#pragma unroll N => !{metadata !"llvm.loop.unroll.count", i32 N}

Now it should (hopefully) be immediately clear what each of these do.  The
loop unrolling transformation itself is not affected.  Other than renaming,
the only functional difference is that a loop can now only have a single
loop unroll directive.  Previously (and confusingly) a loop could have both
unroll(enable) and unroll_count(N).

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/9d051a0d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unroll_metadata.clang.patch
Type: text/x-patch
Size: 24979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/9d051a0d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unroll_metadata.llvm.patch
Type: text/x-patch
Size: 14138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/9d051a0d/attachment-0001.bin>


More information about the cfe-commits mailing list