Page MenuHomePhabricator

[VPlan] Use recursive traversal iterator in VPSlotTracker.
ClosedPublic

Authored by fhahn on Fri, Apr 9, 4:01 AM.

Details

Summary

This patch simplifies VPSlotTracker by using the recursive traversal
iterator to traverse all blocks in a VPlan in reverse post-order when
numbering VPValues in a plan.

This depends on a fix to RPOT (D100169). It also extends the traversal
unit tests to check RPOT.

Diff Detail

Event Timeline

fhahn created this revision.Fri, Apr 9, 4:01 AM
fhahn requested review of this revision.Fri, Apr 9, 4:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Apr 9, 4:01 AM
Herald added a subscriber: vkmr. · View Herald Transcript
a.elovikov added inline comments.Mon, Apr 12, 11:33 AM
llvm/lib/Transforms/Vectorize/VPlan.cpp
1268

I think that such usage would be the most common one (i.e. skipping the regions). Can we outline it into a separate helper somehow? The first idea coming to my mind is our custom VPlanRPOT class using the regular RPOT as a member and exposing iterators through filter_iterator, but maybe something nicer can be done as well.

fhahn updated this revision to Diff 337834.Thu, Apr 15, 11:00 AM

rebased after changes to D100175

fhahn updated this revision to Diff 339729.Thu, Apr 22, 11:08 AM

rebased to use utility from D101093 to create an iterator range that only contains VPBasicBlocks.

fhahn added inline comments.Thu, Apr 22, 11:11 AM
llvm/lib/Transforms/Vectorize/VPlan.cpp
1268

I've put up D101093, which adds a helper to turn an iterator range into an iterator range that only includes VPBasicBlocks and also casts them to VPBasicBlock when de-referencing. It should support arbitrary iterators (RPO, depth first, post order), at the cost of having separate versions for const VPBasicBlock * and VPBasicBLock *

a.elovikov accepted this revision.Thu, Apr 22, 12:22 PM

LGTM, thanks!

This revision is now accepted and ready to land.Thu, Apr 22, 12:22 PM
fhahn updated this revision to Diff 340475.Mon, Apr 26, 3:52 AM

rebased to use blocksOnly iterator.

This revision was automatically updated to reflect the committed changes.