This is an archive of the discontinued LLVM Phabricator instance.

[Dominators] Add PDT constructor from Function
ClosedPublic

Authored by NutshellySima on May 10 2018, 11:20 AM.

Details

Summary

This patch adds a PDT constructor from Function and lets codes previously using a local class to do this use PostDominatorTree class directly.

Diff Detail

Repository
rL LLVM

Event Timeline

NutshellySima created this revision.May 10 2018, 11:20 AM
kuhar added a comment.May 11 2018, 2:24 AM

We can also try to refactor other places in the codebase that first construct PDT and then immediately do PDT.recalculate(F).

unittests/IR/DominatorTreeBatchUpdatesTest.cpp
25 ↗(On Diff #146166)

I think it would be better to replace all uses od PostDomTree with PostDominatorTree

unittests/IR/DominatorTreeTest.cpp
24 ↗(On Diff #146166)

Same as above.

  1. Replace PostDomTree with PostDominatorTree in unittests.
  2. Refactor codes that first construct PDT and do recalculation immediately in PostDominators.cpp.
  3. Replace PostDomTreeBase<BasicBlock> with PostDominatorTree in lib/Transforms/IPO/SampleProfile.cpp.
NutshellySima marked 2 inline comments as done.May 22 2018, 12:10 PM

Looks almost ready -- I found only a couple of cosmetic issues. Once they are fix I can commit it for you.

lib/Transforms/IPO/SampleProfile.cpp
1369 ↗(On Diff #148066)

I think we can construct it directly here, like:
new PostDominatorTree(F))

unittests/IR/DominatorTreeTest.cpp
29 ↗(On Diff #148066)

This seems to exceed the 80-character line limit. Can you format you patch with clang-format-diff.py?

NutshellySima marked an inline comment as done.
NutshellySima edited the summary of this revision. (Show Details)
  1. Construct PostDominatorTree directly from Function in lib/Transforms/IPO/SampleProfile.cpp.
  2. Format the patch.
NutshellySima marked an inline comment as done.May 22 2018, 1:16 PM
kuhar accepted this revision.May 22 2018, 1:18 PM

LGTM.

This revision is now accepted and ready to land.May 22 2018, 1:18 PM
This revision was automatically updated to reflect the committed changes.