This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Fix gathering of the scalars by not ignoring UndefValues.
ClosedPublic

Authored by ABataev on Jul 1 2021, 5:47 AM.

Details

Summary

The compiler should not ignore UndefValue when gathering the scalars,
otherwise the resulting code may be less defined than the original one.
Also, grouped scalars to insert them at first to reduce the analysis in
further passes.

Diff Detail

Event Timeline

ABataev created this revision.Jul 1 2021, 5:47 AM
ABataev requested review of this revision.Jul 1 2021, 5:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2021, 5:47 AM
alexfh added a subscriber: alexfh.Jul 1 2021, 8:01 AM
alexfh added inline comments.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
4876

"values"?

ABataev updated this revision to Diff 355886.Jul 1 2021, 8:05 AM

Fixed a comment

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

Fixed, thanks!

alexfh added a comment.Jul 1 2021, 9:07 AM

The patch fixes the segfaults we've seen after https://reviews.llvm.org/D103458.

alexfh accepted this revision.Jul 1 2021, 9:18 AM

I have no idea what this code is doing, but just based on the fact that it fixes the problem, it looks good to me ;)

You probably want a review from someone who knows this code though.

This revision is now accepted and ready to land.Jul 1 2021, 9:18 AM
Carrot added a comment.Jul 1 2021, 9:30 AM

Thanks for the fix!
The changes to CreateInsertElement looks good to me. But I'm not confident to review other parts of the patch.

jgorbe added a subscriber: jgorbe.Jul 1 2021, 10:51 AM
vdmitrie accepted this revision.Jul 1 2021, 1:22 PM

LGTM. Thank you, Alexey.

Thanks Alexey!