[PATCH] D94972: [SLP]Need to shrink the load vector after reordering.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 19 09:57:47 PST 2021
ABataev added a comment.
In D94972#2507235 <https://reviews.llvm.org/D94972#2507235>, @echristo wrote:
> Is the summary correct? The patch that this is fixing isn't reverted...
>
> It's not clear what this is fixing and why it's fixing it.
>
> Thanks!
>
> -eric
Here is the reverting commit https://reviews.llvm.org/rGbcbdeafa9cb3469a7bf367c17f32d913076a4d55
Before D92668 <https://reviews.llvm.org/D92668>, we could reuse the argument of the shuffle as the instruction and in most cases, we did this. And it masked the issue that exists in the code for the case when there is no shuffle after vectorization of the node. After D92668 <https://reviews.llvm.org/D92668> we could not reuse the argument of the shuffle anymore and should resize the vectorized instructions always if required. But originally we did it incorrectly. If some of the scalars are duplicated in the vectorization tree entry, we do not vectorize them but instead generate a mask for the reuses. But if there are several users of the same entry, they may have different vectorization factors. This is especially important for PHI nodes. In this case, we need to adapt the resulting instruction for the user vectorization factor and have to reshuffle it again to take only unique elements of the vector. Before this patch, the compiler incorrectly returned reduced vector instruction with the same elements, not with the unique ones.
block:
%phi = phi <2 x > { .., %entry} {%shuffle, %block}
%2 = shuffle <2 x > %phi, %poison, <4 x > <0, 0, 1, 1>
... (use %2)
%shuffle = shuffle <2 x> %2, poison, <2 x> {0, 2} <----------------- Currently the compiler emits {0, 1} here but insteasd it should be {0, 2}, otherwise %2 instruction becomes incorrect after the first iteration
br %block
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94972/new/
https://reviews.llvm.org/D94972
More information about the llvm-commits
mailing list