[PATCH] D29473: [AMDGPU] Unroll preferences improvements

Valery Pykhtin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 03:38:32 PST 2017


vpykhtin added inline comments.


================
Comment at: lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:64-65
       if (Alloca) {
+        if (L->hasLoopInvariantOperands(GEP))
+          continue;
+        Type *Ty = Alloca->getAllocatedType();
----------------
rampitec wrote:
> arsenm wrote:
> > Won't LICM move this out of the loop before unrolling?
> In most cases it will, but consider this:
> 
> ```
>   for (int i=0; i < 16; i++)
>     for (int j=0; j < 100; j++)
>       arr[(j + gid) % 64] = a[i];
> ```
> Here arr[j] depends on the induction variable of inner loop, so it is not hoisted. We do not want to unroll outer loop because of that though.
> Actually this check is not sufficient, so I have rewritten this place. I will update review shortly.
Please add this motivating example as a comment


Repository:
  rL LLVM

https://reviews.llvm.org/D29473





More information about the llvm-commits mailing list