This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Improve/fix CSE analysis of the blocks/instructions.
ClosedPublic

Authored by ABataev on Oct 5 2022, 9:05 AM.

Details

Summary

Added analysis for invariant extractelement instructions and improved
detection of the CSE blocks for generated extractelement instructions.

Diff Detail

Event Timeline

ABataev created this revision.Oct 5 2022, 9:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 9:05 AM
ABataev requested review of this revision.Oct 5 2022, 9:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 9:05 AM
vdmitrie added inline comments.Oct 5 2022, 11:31 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8715

At this point Ex is guaranteed to be an instruction. So why dyn_cast?

8749–8750

same seems applies here.

8840–8841

and here

ABataev added inline comments.Oct 5 2022, 11:58 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8715

Just want to be safe, remember some conflicts with possible ConstExprs as operands. I can change it to cast

vdmitrie added inline comments.Oct 5 2022, 1:07 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8715

I don't think such "safety" measure has good justification. If for some reason the cast fires an assertion it will be easy to understand what happened. Otherwise you would allow the issue to go further which sometimes might result in hard to trace performance issues.

ABataev updated this revision to Diff 465734.Oct 6 2022, 7:55 AM

Rebase, tried to address comments

vdmitrie accepted this revision.Oct 6 2022, 9:32 AM

LG. Thanks!

This revision is now accepted and ready to land.Oct 6 2022, 9:32 AM
This revision was automatically updated to reflect the committed changes.