This is an archive of the discontinued LLVM Phabricator instance.

[SLP] Don't try to vectorize pair with insertelement
ClosedPublic

Authored by anton-afanasyev on Feb 13 2022, 1:12 PM.

Details

Summary

Particularly this breaks vectorization of insertelements where some of
intermediate (i.e. not last) insertelements are used externally.

Fixes PR52275
Fixes #51617

Diff Detail

Event Timeline

anton-afanasyev requested review of this revision.Feb 13 2022, 1:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 13 2022, 1:12 PM
ABataev added inline comments.Feb 13 2022, 1:53 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4040

I would try to do this a bit earlier and simpler. Before calling tryToVectorizePair (or something like this) it is just enough to check that one of the instructions is insertelement. And just do not try vectorization in this case.

anton-afanasyev marked an inline comment as done.Feb 14 2022, 1:26 AM
anton-afanasyev added inline comments.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4040

Ok, done this way. Though need to keep in mind other paths for inserts get to buildTree().

anton-afanasyev marked an inline comment as done.

Address comments

anton-afanasyev retitled this revision from [SLP] Prohibit vectorization of externally used intermediate insertelements to [SLP] Don't try to vectorize pair with insertelement.Feb 14 2022, 1:27 AM
anton-afanasyev edited the summary of this revision. (Show Details)
ABataev accepted this revision.Feb 14 2022, 3:14 AM

LG

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4040

If there are other paths, just need to add a check there too, need to handle insertelements only from buildvector vectorization attempt.

This revision is now accepted and ready to land.Feb 14 2022, 3:14 AM
anton-afanasyev marked an inline comment as done.Feb 14 2022, 3:22 AM
anton-afanasyev added inline comments.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4040

There are no other paths for now, I meant, in future.

This revision was landed with ongoing or failed builds.Feb 15 2022, 5:13 AM
This revision was automatically updated to reflect the committed changes.