[PATCH] Add loop unrolling metadata descriptions to LangRef.rst

Mark Heffernan meheff at google.com
Fri Jul 18 10:28:21 PDT 2014


================
Comment at: docs/LangRef.rst:2965
@@ +2964,3 @@
+bit operand value is 0 loop unrolling is disabled. A value of 1
+indicates that the loop should be fully unrolled. For example:
+
----------------
Mark Heffernan wrote:
> hfinkel at anl.gov wrote:
> > I find this confusing. Specifically, to get partial unrolling, what needs to happen? If I want partial unrolling with a specific count, do I need both the 'count' and 'enable' metadata?
> I added a bit more explanation about that case.
> 
> I'd imagine an underlying cause of confusion is that ``llvm.loop.unroll.enable 1`` doesn't exactly mean enable.  It means try to fully unroll the loop.  So we want the following possible hints:
> 
> don't unroll
> unroll fully
> unroll by N
> 
> This doesn't exactly map nicely to the two metadata we have (one with boolean operand, one with i32).  Maybe a cleaner way to have done this is with the following metadata:
> 
> llvm.loop.unroll.disable (no operand)
> llvm.loop.unroll.fully_unroll (no operand)
> llvm.loop.unroll.count i32
> 
> And only allow a single loop unroll metadata node per loop.  Worth making this change?
I should add that this confusion is also baked into the pragma syntax.  The following means unroll fully:

#pragma clang loop unroll(enable)

http://reviews.llvm.org/D4576






More information about the llvm-commits mailing list