This is an archive of the discontinued LLVM Phabricator instance.

[SLP] Allow vectorization of the instruction from the same basic blocks only, NFC.
ClosedPublic

Authored by ABataev on Jun 30 2017, 7:21 AM.

Details

Summary

After some changes in SLP vectorizer we missed some additional checks to
limit the number of instructions for vectorization. We should not perform analysis
of the instructions if the parent of instruction is not the same as the
parent of the first instruction in the tree or it was analyzed already.

Diff Detail

Repository
rL LLVM

Event Timeline

ABataev created this revision.Jun 30 2017, 7:21 AM
ABataev retitled this revision from [SLP] Allow vectorization of the instruction from the same basic blocks only. to [SLP] Allow vectorization of the instruction from the same basic blocks only, NFC..Jun 30 2017, 10:08 AM
ABataev edited the summary of this revision. (Show Details)
ABataev added reviewers: mkuper, anemet, anna.
ABataev added a subscriber: llvm-commits.
anna added inline comments.Jul 28 2017, 11:19 AM
lib/Transforms/Vectorize/SLPVectorizer.cpp
4771 ↗(On Diff #104886)

Could you please explain why you bail out here? If it's for clamping the number of operands, that'll get operated on the loop below, why not just limit the recursion depth to 6 instead of 12?

4825 ↗(On Diff #104886)

Please add a comment here explicitly stating that you're limiting this to the same basic block to save compile time.

ABataev marked an inline comment as done.Jul 28 2017, 11:57 AM
ABataev added inline comments.
lib/Transforms/Vectorize/SLPVectorizer.cpp
4771 ↗(On Diff #104886)

I tried to reduce the number of checks for PHINode inside the loop and reduce number of ush_backs/pop_backs to Stack. In the existing code if the next instruction is PHINode, we push_back it to Stack, then pop it up from Stack and drop it. New code tries to avoid such extra dummy operations.

4825 ↗(On Diff #104886)

Will do

ABataev updated this revision to Diff 108690.Jul 28 2017, 11:59 AM
ABataev marked an inline comment as done.

Update after review

anna accepted this revision.Jul 28 2017, 12:40 PM

LGTM.

This revision is now accepted and ready to land.Jul 28 2017, 12:40 PM
This revision was automatically updated to reflect the committed changes.