DivergenceAnalysis: Fix crash with no return blocks

The post dominator tree does not have a root node in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268933 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2016-05-09 16:57:08 +00:00
parent 98959b5434
commit 51485ffe89
2 changed files with 37 additions and 1 deletions
+7 -1
View File
@@ -143,7 +143,13 @@ void DivergencePropagator::exploreSyncDependency(TerminatorInst *TI) {
if (!DT.isReachableFromEntry(ThisBB))
return;
BasicBlock *IPostDom = PDT.getNode(ThisBB)->getIDom()->getBlock();
// If the function has no exit blocks or doesn't reach any exit blocks, the
// post dominator may be null.
DomTreeNode *ThisNode = PDT.getNode(ThisBB);
if (!ThisNode)
return;
BasicBlock *IPostDom = ThisNode->getIDom()->getBlock();
if (IPostDom == nullptr)
return;