[PATCH] D71689: Improve LLVM existing loopinterchange

Masakazu Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 23:23:01 PST 2019


masakazu.ueno created this revision.
masakazu.ueno created this object with visibility "All Users".
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Ex-1) An existing LLVM loop interchange cannot optimize following loop.

#define IMAX 100
#define JMAX 100
#define KMAX 100
int a_array[IMAX][JMAX][KMAX],b_array [IMAX][JMAX][KMAX];
void loop_interchange_0() {
int i, j, k;
for (i=0; i<IMAX; i++)

  for (j=0; j<JMAX; j++)
    for (k=0; k<KMAX; k++)
      a_array[j][i][k] = a_array[j][i][k] * b_array[j][i][k];

}

*) The j and i loops are not interchanged.

Ex-2) Optimization of Existing LLVM Loop interchange is Incomplete.

#define IMAX 100
#define JMAX 100}}
 #define KMAX 100}}

  int a_array[IMAX][JMAX][KMAX],b_array [IMAX][JMAX][KMAX];}}
  void loop_interchange_0()}}

{

int i, j, k;

for (i=0; i<IMAX; i++) {

  for (j=0; j<JMAX; j++)   {
  
    for (k=0; k<KMAX; k++)

{       a_array[k][j][i] = a_array[k][j][i] * b_array[k][j][i];       }

   }
  
  }

}

*) Because the intrerchange inside the multiple loops is incomplete, it remains a stride access.


Repository:
  rL LLVM

https://reviews.llvm.org/D71689

Files:
  lib/Transforms/Scalar/LoopInterchange.cpp
  test/Transforms/LoopInterchange/interchangeable.ll
  test/Transforms/LoopInterchange/phi-ordering.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71689.234664.patch
Type: text/x-patch
Size: 14880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191219/6d2c88ce/attachment.bin>


More information about the llvm-commits mailing list