[PATCH] D104180: [NFC] [LICM] Create LoopNest Invariant Code Motion (LNICM) pass

toshiki maekawa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 20 03:10:20 PDT 2021


uint256_t added a comment.

I'm sorry to be late to reply.
I'm making small tests and some code changes to demonstrate the following:

- LNICM only hoists invariants out of the outermost loop, to keep/make perfect loop nest
  - `x[k][j]` below could be hoisted out of `i`-loop (by LICM), but LNICM wouldn't do that because it would break the perfect nest loop.

  void test(int arr[10][10][10], int x[10][10]) {
    for (int k = 0; k < 10; k++) 
      for (int j = 0; j < 10; j++) 
        for (int i = 0; i < 10; i++) 
          arr[i][k][j] += x[k][j];
  }


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

https://reviews.llvm.org/D104180



More information about the llvm-commits mailing list