[llvm] Late temporal divergence lowering for SDAG (PR #67033)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 16:15:36 PDT 2023


ruiling wrote:

 > If all of those can be sunk out of the loop, that would be done in some early ir pass. S_ADD is used by some phi (easiest is to think about it as "loop counter" - the "++i") and cannot be sunk out of the loop

In the example, `%0` is not an induction variable, but a user of induction variable (see below example), it cannot be sunk out of the loop in early ir pass because it has a user `%1` in the loop. Now we allow `%1` to be sunk out of the loop, then `%0` will also be sunk out.
```
bb.loop:
  %ind = PHI %ind_inc, %bb.loop, ...
  %ind_inc = S_ADD %ind, ...
  %0 = S_ADD %ind, ...
  %1 = V_ADD %0, ...
  ...
  SI_LOOP  %bb.loop ...
  S_BRANCH %bb.exit

bb.exit
  ... = %1
```


https://github.com/llvm/llvm-project/pull/67033


More information about the llvm-commits mailing list