<div dir="ltr">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: <a href="http://reviews.llvm.org/D4571">http://reviews.llvm.org/D4571</a>. Prior to this patch we have the following pragma syntax and the corresponding metadata it generates:<div>
<br></div><div>#pragma clang loop unroll(enable) => !{metadata !"llvm.loop.unroll.enable", i1 true}</div><div>#pragma clang loop unroll(disable) => !{metadata !"llvm.loop.unroll.enable", i1 false}</div>
<div>#pragma clang loop unroll_count(N) => !{metadata !"llvm.loop.unroll.count", i32 N}</div><div><br></div><div>#pragma unroll => !{metadata !"llvm.loop.unroll.enable", i1 true}</div><div>#pragma unroll N => !{metadata !"llvm.loop.unroll.count", i32 N}</div>
<div><br></div><div>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:</div>
<div><br></div><div><div>#pragma clang loop unroll(full) => !{metadata !"llvm.loop.unroll.full"}</div><div>#pragma clang loop unroll(disable) => !{metadata !"llvm.loop.unroll.disable"}</div><div>
#pragma clang loop unroll_count(N) => !{metadata !"llvm.loop.unroll.count", i32 N}</div></div><div><br></div><div><div>#pragma unroll => !{metadata !"llvm.loop.unroll.full"}</div><div>#pragma unroll N => !{metadata !"llvm.loop.unroll.count", i32 N}</div>
</div><div><br></div><div>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).</div>
<div><br></div><div>Mark</div></div>