This is an archive of the discontinued LLVM Phabricator instance.

[Dominators] Ensure that every PostDomTree root is connected to the virtual node
AbandonedPublic

Authored by kuhar on Feb 12 2018, 4:38 PM.

Details

Summary

This patch teaches .verifyRoots to check if all roots are connected to the virtual root.

Diff Detail

Event Timeline

kuhar created this revision.Feb 12 2018, 4:38 PM

Hi @kuhar , is there a testcase that causes this to fail?

kuhar added a comment.Feb 12 2018, 7:02 PM

Hi @kuhar , is there a testcase that causes this to fail?

I was only able to make it fail by manually updating the tree; this doesn't catch the recent update error reported by @dmgreen. It just made me notice that we are missing this check.
This is actually quite annoying, because with postdominators there can be multiple correct tree and the checks that we currently have are not able to ensure that after the sequence we always arrive to the same tree. For now, the other patch (D43140) makes the verifier do the comparison with a fresh tree at the end.

Let me know if you know how to ensure the PDT is in canonical form after updates, I don't have any more ideas for it :(

Ah. Ok. Common forward dominators are not roots - of course they are not. That makes this harder.

After spending a day thinking about it, I have not come up with a sensible way to check this, that doesn't devolve into recalculating the tree (or worse). Especially as in this case we can't really trust the domtree to be "correct", with respects to the roots.

I was trying to come up with something where non-roots have non-virtual idoms or are reachable from 2+ roots. I'm not sure that can work though (or how slow it could be). I guess it may be simpler to just compare against a new tree, like we have already.

kuhar abandoned this revision.Jun 27 2018, 10:00 AM