[PATCH] D91481: [LoopUnroll] Discount uniform instructions in cost models

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 15:38:42 PDT 2021


reames added a comment.

In D91481#2783436 <https://reviews.llvm.org/D91481#2783436>, @nikic wrote:

>> The reasoning here is that such an expression (as determined by SCEV) will be CSEd once the loop is unrolled.
>
> Is that really the case? I don't think unrolling itself does any CSE, and runtime unrolling is run at the very end of the pipeline, so we don't have any EarlyCSE or GVN passes after it.

If this is a problem in practice, we can add simple CSE to the unroll transform.

> Also, the converse question: Why have invariant instructions not been hoisted by LICM before unrolling is reached?

This uses SCEV's notion of invariant, not Loops.  As an example, LIV udiv LIV2 is invariant, but can't be hoisted unless we can prove LIV2 != 0.


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

https://reviews.llvm.org/D91481



More information about the llvm-commits mailing list