Fix dominator descendants for unreachable blocks.
authorDiego Novillo <dnovillo@google.com>
Mon, 2 Dec 2013 14:08:27 +0000 (14:08 +0000)
committerDiego Novillo <dnovillo@google.com>
Mon, 2 Dec 2013 14:08:27 +0000 (14:08 +0000)
commit97add46aeea26db338f68f16aaf2587737ab46da
tree4319b8962e7a45ccf859745bef2087bc5e07ef07
parentc15aff93c49dabb5ed174fd3731c7219e96af1f4
Fix dominator descendants for unreachable blocks.

When a block is unreachable, asking its dom tree descendants should
return the empty set. However, the computation of the descendants
was causing a segmentation fault because the dom tree node we get
from the basic block is initially NULL.

Fixed by adding a test for a valid dom tree node before we iterate.

The patch also adds some unit tests to the existing dom tree tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196099 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/Dominators.h
unittests/IR/DominatorTreeTest.cpp