This is an archive of the discontinued LLVM Phabricator instance.

[VPlan] Exit earlier when trying to widen with scalar VFs.
ClosedPublic

Authored by fhahn on May 5 2022, 11:32 AM.

Details

Summary

This simplifies the code a bit, suggested in D124718.

Diff Detail

Event Timeline

fhahn created this revision.May 5 2022, 11:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 11:32 AM
fhahn requested review of this revision.May 5 2022, 11:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 5 2022, 11:32 AM
Herald added a subscriber: vkmr. · View Herald Transcript
Ayal added a comment.May 21 2022, 1:17 AM

Thanks for following up!

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8608

isOptimizableIVTruncate may hold for VF=1?

8612

(shouldWiden will bail out here for VF=1, if we didn’t bail out earlier)

fhahn updated this revision to Diff 431246.May 22 2022, 12:18 PM

Move code to optimize truncates before scalar VF check. Test to check this added in 0c000d77ad09665a0debeb.

fhahn marked 2 inline comments as done.May 22 2022, 12:22 PM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8608

Good point, kept the code before checking for scalar VFs. I also added a test in 419e49621fb4.

8612

Yep, even though it doesn't explicitly check for scalar VFs.

Ayal accepted this revision.May 22 2022, 2:39 PM

Thanks for following up!

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8588

Unrelated nits while we're here: above could benefit slightly from condition reversal, below needs its indentation fixed.

8611

Would be good to add a comment stating that all other "Widen" recipes from here on deal only with VF>1.

This revision is now accepted and ready to land.May 22 2022, 2:39 PM
This revision was landed with ongoing or failed builds.May 25 2022, 3:06 AM
This revision was automatically updated to reflect the committed changes.
fhahn marked 2 inline comments as done.
fhahn marked 2 inline comments as done.May 25 2022, 3:10 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
8588

I'll fix the indent separately.

above could benefit slightly from condition reversal,

Do you mean handling the single line case first?

8611

Good point, I added a comment in the committed version.