This is an archive of the discontinued LLVM Phabricator instance.

[SLP][NFC] Pre-commit test showing deficiency in current roots selection algorithm
ClosedPublic

Authored by vdmitrie on Apr 22 2022, 12:55 PM.

Details

Summary

The test case to show not quite optimal SLP vectorization.

Diff Detail

Event Timeline

vdmitrie created this revision.Apr 22 2022, 12:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2022, 12:55 PM
vdmitrie requested review of this revision.Apr 22 2022, 12:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2022, 12:55 PM

The test filename is vectorize-pair-path.ll, but the description says that this test is about root selection, so perhaps rename it to something like root-selection.ll? The impression I am getting from the current name is that this test is about the path followed by buildTreeRec().

llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
6

Please explain briefly in a comment which roots should be selected instead of the current ones.

7

Nit: perhaps a more relevant function name, like root_selection or something similar.

vdmitrie added inline comments.Apr 22 2022, 1:24 PM
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
6

Here we start trying to vectorize reduction but end up in tryToVectorize() method which then makes several attempts of finding something that can be vectorized.
The way it makes probes for various pairs is predefined by its implementation. That is what I mean here by "path".

vporpo accepted this revision.Apr 22 2022, 1:33 PM

LG

llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
6

Sounds good, please add some of this text in the test so that whoever reads it knows what it is about.

This revision is now accepted and ready to land.Apr 22 2022, 1:33 PM
vdmitrie updated this revision to Diff 424596.Apr 22 2022, 1:52 PM

Added test description and renamed function as per suggestion.

vdmitrie marked an inline comment as done.Apr 22 2022, 1:55 PM
vdmitrie added inline comments.
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
6

Thank you. I added description to make its purpose clearer.

This revision was landed with ongoing or failed builds.Apr 22 2022, 2:48 PM
This revision was automatically updated to reflect the committed changes.
RKSimon added inline comments.Apr 23 2022, 3:45 AM
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
49

Why are there undef float-ops? Is this the only way to expose the issue? If you run this through opt -O3 all you get is a posion result.

ABataev added inline comments.Apr 23 2022, 7:56 AM
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
49

It is ok for SLP to have some undefs unless you do not use instcombine. You can treat undef here as a specific op kind, different from others. Just to reduce the size of the test.

vdmitrie added inline comments.Apr 25 2022, 9:47 AM
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
49

Yeah, this shouldn't go through instcombine. There were even more undefs after bugpoint reduced the original case so I had to step beck a bit and replaced some with FP constants to make tracing SLP vectorizer behavior easier.

vdmitrie added inline comments.Apr 25 2022, 9:51 AM
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll
49

typo: back (not "beck")