This is an archive of the discontinued LLVM Phabricator instance.

[VPlan] Add vp_depth_first_shallow + graph traits for wrapper(NFC)
ClosedPublic

Authored by fhahn on Dec 21 2022, 3:27 PM.

Details

Summary

This patch adds a new VPBlockNonRecursiveTraversalWrapper struct to
provide graph traits specialization that do not traverse through
VPRegionBlocks. This matches the behavior of the existing traits for
plain VPBlockBase and is a step before moving the graph traits for
VPBlockBase to traverse through VPRegionBlocks to enable cross region
support in VPDominatorTree.

Depends on D140511.

Diff Detail

Event Timeline

fhahn created this revision.Dec 21 2022, 3:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 21 2022, 3:27 PM
fhahn requested review of this revision.Dec 21 2022, 3:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 21 2022, 3:27 PM
Ayal accepted this revision.Jan 17 2023, 9:35 PM

Ship it!

llvm/lib/Transforms/Vectorize/VPlanCFG.h
322

nit: for completeness can also introduce vp_depth_first_recursive(VPBlockBase *G) which returns depth_first(VPBlockRecursiveTraversalWrapper<VPBlockBase *>(G)); used elsewhere.

nit: "recursive" here stands for traversing inside regions of the hierarchical CFG. Perhaps a more accurate term is "deep" versus "flat" or "shallow", given the recursive nature of DFS itself.

This revision is now accepted and ready to land.Jan 17 2023, 9:35 PM
fhahn updated this revision to Diff 490279.Jan 18 2023, 1:37 PM
fhahn marked an inline comment as done.

Adjust naming, add comment.

llvm/lib/Transforms/Vectorize/VPlanCFG.h
322

nit: for completeness can also introduce vp_depth_first_recursive(VPBlockBase *G) which returns depth_first(VPBlockRecursiveTraversalWrapper<VPBlockBase *>(G)); used elsewhere.

I'll add a separate patch for that.

nit: "recursive" here stands for traversing inside regions of the hierarchical CFG. Perhaps a more accurate term is "deep" versus "flat" or "shallow", given the recursive nature of DFS itself.

Updated the name to use _shallow instead of non recursive, thanks!

fhahn retitled this revision from [VPlan] Add vp_depth_first_nonrecursive + graph traits for wrapper(NFC) to [VPlan] Add vp_depth_first_shallow + graph traits for wrapper(NFC).Jan 18 2023, 1:37 PM
Ayal added inline comments.Jan 19 2023, 12:22 AM
llvm/lib/Transforms/Vectorize/VPlanCFG.h
322

Very good! Worth also renaming VPBlockNonRecursiveTraversalWrapper as VPBlockShallowTraversalWrapper to be consistent?

This revision was landed with ongoing or failed builds.Jan 19 2023, 4:07 AM
This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.Jan 19 2023, 4:08 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/VPlanCFG.h
322

Done in the committed version, also added a comment to the definition of it.