This is an archive of the discontinued LLVM Phabricator instance.

[Dominators] Improve reachability verification
ClosedPublic

Authored by kuhar on Jul 11 2017, 4:31 PM.

Details

Summary

This patch improves verification by making verifyReachablility look for CFG not found in the DomTree.
It also makes the verification work with postdominators by handling virtual root.

Diff Detail

Repository
rL LLVM

Event Timeline

kuhar created this revision.Jul 11 2017, 4:31 PM
dberlin added inline comments.Jul 11 2017, 8:31 PM
include/llvm/Support/GenericDomTreeConstruction.h
302 ↗(On Diff #106113)

It's more accurate to state that the virtual root *is* a cfg node. Or at least it was.
At least as used previously, the virtual root was not really a dom tree root, it was really the thing that contained the edges to the blocks.

The virtual dom tree root was then the dom tree node that got built for the virtual cfg root.

I don't know if this is still the case.

305 ↗(On Diff #106113)

When is it possible to have !BB but it's not a virtual root?
If it's really possible, please document this condition.

kuhar added inline comments.Jul 11 2017, 9:42 PM
include/llvm/Support/GenericDomTreeConstruction.h
302 ↗(On Diff #106113)

I mean, if you ask a virtual root for its (CFG) block, it returns a nullptr. Do you consider this nullptr block a virtual CFG exit node?

302 ↗(On Diff #106113)

(Or in the future, a virtual entry block for dominators?)

305 ↗(On Diff #106113)

It's just an oversight when cherry-picking changes :)

dberlin added inline comments.Jul 12 2017, 8:18 AM
include/llvm/Support/GenericDomTreeConstruction.h
302 ↗(On Diff #106113)

The fact that we don't hand the virtual CFG block to people is fine (but possibly annoying):

Remember the dominator tree does not have predecessor edges, etc.

So either you are hard coding the logic for it being a CFG block, or it's really got a virtual CFG block :P

Right now I believe it's the case we hard-code the logic during post-dom construction.

kuhar updated this revision to Diff 106329.Jul 12 2017, 3:46 PM
kuhar marked 2 inline comments as done.
kuhar added inline comments.
include/llvm/Support/GenericDomTreeConstruction.h
302 ↗(On Diff #106113)

Is it better now?

dberlin accepted this revision.Jul 13 2017, 10:13 AM
This revision is now accepted and ready to land.Jul 13 2017, 10:13 AM
This revision was automatically updated to reflect the committed changes.