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

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 08:06:36 PDT 2021


Whitney added inline comments.


================
Comment at: llvm/test/Transforms/LICM/lnicm-sink.ll:15
+;     }
+;     y[i] = s;
+;   }
----------------
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;
```
?


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

https://reviews.llvm.org/D107219



More information about the llvm-commits mailing list