Page MenuHomePhabricator

[SLP]Improve vectorization of PHI instructions.
ClosedPublic

Authored by ABataev on Jun 3 2021, 11:18 AM.

Details

Summary

Perform better analysis when trying to vectorize PHIs.

  1. Do not try to vectorize vector PHIs.
  2. Do deeper analysis for more profitable nodes for the vectorization.

Before we just tried to vectorize the PHIs of the same type. Patch
improves this and tries to vectorize PHIs with incoming values which
come from the same basic block, have the same and/or alternative
opcodes.

It allows to save the compile time and provides better vectorization
results in general.

Part of D57059.

Diff Detail

Event Timeline

ABataev created this revision.Jun 3 2021, 11:18 AM
ABataev requested review of this revision.Jun 3 2021, 11:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 3 2021, 11:18 AM
RKSimon added inline comments.Jun 12 2021, 3:11 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8392

NIT (to match the order in the previous lambda):

if (S.getOpcode())
  continue;
return false;
xbolva00 added inline comments.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8498

Maybe handle this TODO too?

ABataev added inline comments.Jun 12 2021, 3:55 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
8498

This a separate problem, I think, will try to implement it in a different patch.

ABataev updated this revision to Diff 352099.Jun 15 2021, 5:07 AM

Rebase + address a comment

RKSimon accepted this revision.Jun 15 2021, 6:58 AM

LGTM

This revision is now accepted and ready to land.Jun 15 2021, 6:58 AM
This revision was automatically updated to reflect the committed changes.