[PATCH] D107219: [LICM] Support sinking in LNICM

toshiki maekawa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 08:10:41 PDT 2021


uint256_t added inline comments.


================
Comment at: llvm/test/Transforms/LICM/lnicm-sink.ll:15
+;     }
+;     y[i] = s;
+;   }
----------------
Whitney wrote:
> uint256_t wrote:
> > Whitney wrote:
> > > uint256_t wrote:
> > > > Whitney wrote:
> > > > > Why `y[i] = s;` is needed for this test case?
> > > > It is to show that LNICM maintains perfect loop nest.
> > > > LICM sinks `s = abs(i);` to right before `y[i] = s;`, whereas LNICM doesn't do so.
> > > Why wouldn't LICM sink `s = abs(i);` without `y[i] = s;`?
> > LICM would hoist (not sink) `s = abs(i);` out of loop-j.
> how about 
> ```
> ;   for (int i = 0; i < 10; i++) {
> ;     for (int j = 0; j < 10; j++) {
> ;       t = sin(x);
> ;       s = abs(i);
> ;     }
> ;   }
> ;  return t + s;
> ```
> ?
Oh, it is way better. I'll edit this test case. Thank you.


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

https://reviews.llvm.org/D107219



More information about the llvm-commits mailing list