This is an archive of the discontinued LLVM Phabricator instance.

[SLP][NFC] Refactor SLPVectorizerPass::vectorizeRootInstruction method.
ClosedPublic

Authored by vdmitrie on Aug 24 2022, 1:43 PM.

Details

Summary

The goal is to separate collecting items for post-processing and processing them.
Post processing also outlined as dedicated method.

Diff Detail

Event Timeline

vdmitrie created this revision.Aug 24 2022, 1:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2022, 1:43 PM
vdmitrie requested review of this revision.Aug 24 2022, 1:43 PM
ABataev added inline comments.Aug 24 2022, 1:52 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
11807–11808

It can be merged:

if (auto *Inst = dyn_cast<Instruction>(Op); Inst && !R.isDeleted(Inst))
vdmitrie added inline comments.Aug 24 2022, 1:55 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
11807–11808

I'll make this cleanup in the main patch during outlining. Is that okay with you?

ABataev added inline comments.Aug 24 2022, 2:01 PM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
11807–11808

Can you outline this code in this patch?

vporpo added inline comments.Aug 24 2022, 2:33 PM
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
128

Nit: This function does the actual work, so we should probably use different names for this and for the one below. Perhaps vectorizeRootInstructionImpl ?

vdmitrie updated this revision to Diff 455391.Aug 24 2022, 3:02 PM
vdmitrie edited the summary of this revision. (Show Details)

Update as per request

vdmitrie marked 2 inline comments as done.Aug 24 2022, 3:07 PM
vdmitrie added inline comments.
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
128

To be honest I'm not a big fan of such naming for methods (unless it really necessary).
If you do not insist on the change I'd keep both using same name.

vporpo added inline comments.Aug 24 2022, 3:30 PM
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
128

Well, using the same function name is fine as long as they do the exact same thing, but in this case the caller also dealing with the postponed values. Yeah, I prefer more descriptive names too than *Impl, but in this case I can't think of anything better. Anyway, feel free to keep the same name.

vdmitrie added inline comments.Aug 24 2022, 3:47 PM
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
128

Changing the name to vectorizeHorReduction would probably fit better.

This revision is now accepted and ready to land.Aug 24 2022, 4:26 PM
This revision was landed with ongoing or failed builds.Aug 24 2022, 5:12 PM
This revision was automatically updated to reflect the committed changes.