Meinersbur added a comment.

In D57978#1440894 <https://reviews.llvm.org/D57978#1440894>, @dmgreen wrote:

> This could maybe do with a few extra tests. Am I correct in saying something 
> like this:
>
>   #pragma unroll_and_jam(4)
>   for(int j = 0; j < n; j++) {
>     #pragma unroll(4)
>     for(int k = 0; k < n; k++) {
>       x[j*n+k] = 10;
>     }
>   }
>
>
> would end up with a llvm.loop.unroll_and_jam.followup_inner with a 
> llvm.loop.unroll_count?


correct. I added a new test `pragma-followup_inner.cpp` where this can be seen.



================
Comment at: lib/CodeGen/CGLoopInfo.cpp:500
+    // Unroll-and-jam of an inner loop and unroll-and-jam of the same loop as
+    // the outer loop does not make much sense, but we have to pick an order.
+    AfterJam.UnrollAndJamCount = Attrs.UnrollAndJamCount;
----------------
dmgreen wrote:
> I was having trouble parsing this sentance. Does it mean both the inner loop 
> and the outer loop both have unroll-and-jam? UnrollAndJam processes loops 
> from inner to outer, so if this is working as I think, maybe it should be put 
> into BeforeJam.
> Does it mean both the inner loop and the outer loop both have unroll-and-jam? 

Correct. I was thinking of such a case:
```
#pragma unroll_and_jam(2)
for (int i = 0; i < m; i+=1)
  #pragma unroll_and_jam(3)
  for (int j = 0; j < n; j+=1)
```

Assuming the inner unroll-and-jam would do something, would it happen before or 
after the outer transformation. As you mentioned, there is an argument to put 
it into `BeforeJam`. Changed.


================
Comment at: lib/CodeGen/CGLoopInfo.cpp:502
+    AfterJam.UnrollAndJamCount = Attrs.UnrollAndJamCount;
+    AfterJam.UnrollAndJamEnable = AfterJam.UnrollAndJamEnable;
+
----------------
dmgreen wrote:
>  = Attrs.UnrollAndJamEnable ?
thanks


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57978/new/

https://reviews.llvm.org/D57978



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to