[PATCH] D28767: Do not verify Dominator tree if it has no roots

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 08:20:48 PST 2017


+Chandler.


On Wed, Jan 25, 2017 at 7:04 AM, Serge Pavlov <sepavloff at gmail.com> wrote:

> The fact is that sometimes domtree is not available.
>


Then why is there a DominatorTree * to use?
It's fine for the analysis to be not available. When that happens,it should
not produce a DominatorTree *.

IE DominatorTree * should be a nullptr you can check against.


> If a function is `available_externally`  all codegen passes are skipped,
> although they are marked as required.
>

See above :)


> MachineDominatorTree is also skipped and there is no domtree at all.
>

Again, so why is there a DominatorTree * to use?


> Attempt to call `getRoot` for such domtree will obviously cause a crash.
> There is no way to get 'right' domtree in this case, so prior to using it
> we must either:
> 1. Check if corresponding pass was indeed run, or
> 2. Check the domtree state trying to reveal if it is valid.
> The first approach was taken in https://reviews.llvm.org/D27190 but it
> was not accepted. This fix tries to use variant 2.
>


>
> Just to emphasize a key point: there are cases when domtree is absent
> because the pass that it creates was not run and this behavior is by design.
>
>
and in those cases, we should  not try to create an invalid datastructure.
We should create no datastructure, and let people test against the nullptr.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170125/75b0d52b/attachment.html>


More information about the llvm-commits mailing list