[llvm] [NFC][LoopVectorize] Cache result of requiresScalarEpilogue (PR #108981)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 08:44:16 PDT 2024
david-arm wrote:
> > > Would it be simpler to have a separate helper `setRequiresScalarEpilogue` that's called once up-front with `requiresScalarEpilogue` simply returning the decision as done in multiple other places?
> >
> >
> > OK, I've tried doing this, but I realised there are places where we have to invalidate the decision due to changes in the scalar epilogue status or interleave groups. However, that also means my first version was also incorrect even though all tests passed!
>
> Thanks for checking, does this mean we are missing a new test to cover this case?
So for the interleave info case I couldn't find any possible scenario where requireScalarEpilogue would change value after invalidating the interleave groups. For example if you have an interleave group with gaps in a block that needs predication and you happen to support masked interleaved accesses, then we'll require a scalar epilogue. But the place that invalidates the interleave info later on requires that you *don't* support masked interleaved accesses.
However, I did find an issue with my original patch when changing the scalar epilogue lowering status. I realised we have a missing test case where we request predication on a loop that requires a scalar epilogue (due to an early exit). We should correctly refuse to tail-fold and fall back on normal vectorisation and jump to the scalar epilogue for the last iteration. This test was broken with my previous patch, which I've now fixed.
https://github.com/llvm/llvm-project/pull/108981
More information about the llvm-commits
mailing list