[llvm-dev] [RFC] Simple GVN hoist

Florian Hahn via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 16 03:59:34 PDT 2021



> On Sep 15, 2021, at 18:04, Momchil Velikov <momchil.velikov at gmail.com> wrote:
> 
> On Wed, Sep 15, 2021 at 5:17 PM Sjoerd Meijer <Sjoerd.Meijer at arm.com> wrote:
>> The SLP vectoriser will fail to vectorise this because it wasn't taught to emit runtime alias analysis checks.
> 
> It likely needs more than that - manually hoisting all the loads and
> adding `restrict` still does not vectorise at `-O3`:
> https://gcc.godbolt.org/z/z3KjaYv9d

Besides alias runtime checks for SLP, there’s an additional problem: SLP doesn’t really do if-conversion at the moment for this case and instead relies on SimplifyCFG. SimplifyCFG’s if-conversion doesn’t trigger, because there are too many instructions to duplicate. If we give SimplifyCFG more leeway (-mllvm -two-entry-phi-node-folding-threshold=10), it also gets vectorized with -O3: https://gcc.godbolt.org/z/qarnMbo5M <https://gcc.godbolt.org/z/qarnMbo5M>

Ideally the SLP vectorizer would be able to perform vector if conversion directly when profitable. That way, we will also vectorize in cases where LV doesn’t kick in (e.g. due to very low trip counts) or if there’s no loop to start with.

Cheers,
Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210916/eb8d5046/attachment.html>


More information about the llvm-dev mailing list