[PATCH] D102748: [LoopUnroll] Don't unroll before vectorisation

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 02:52:05 PDT 2021


fhahn added a comment.

In D102748#2770563 <https://reviews.llvm.org/D102748#2770563>, @SjoerdMeijer wrote:

> In D102748#2769065 <https://reviews.llvm.org/D102748#2769065>, @reames wrote:
>
>> Not directly on topic for this review, but looking at some of the examples given, I'd point out that these are simply missed optimizations.  If we're given vectorized IR and not performing other simple optimization (loop idiom, dce, etc..), those are optimization bugs we should probably fix.
>>
>> It also sounds like it might be worth having the vectorizer recognize the case where it can vectorize all iterations in a single vector iteration and break the backedge if so.  This would avoid the need for another pass of loop deletion or unrolling before scalar opts could easily kick in.
>>
>> If we improved the robustness of our other optimizations w.r.t. vector instructions, we'd probably be a lot less sensitive to the proposed pass reordering.
>
> Thanks @reames , this is an interesting view, which I agree with.
>
> In terms of how to progress this best, this is probably the path of least resistance as it involves fixing up one pass as opposed to a pass reordering + fixing several:

I think the main problem in the examples I shared is that we don't run various passes like DSE after late unrolling. Independent of any pass-ordering issues, it would be good for DSE to be able to analyze & detect loops that initialize/overwrite a memory range.

>> true, but the main problem here is SLP vectorizer & missed vectorizations.
>>
>> If https://reviews.llvm.org/D28907 is finished and commited & SLP gains ability to emit RT checks, I think these both improvements in SLP could fix quite a lot missed vectorization opportunities.
>
> So I think I am going to look into this first.

I put up a sketch to get a discussion started on how to best support memory runtime check generation for SLP: D102834 <https://reviews.llvm.org/D102834>


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

https://reviews.llvm.org/D102748



More information about the llvm-commits mailing list