Do not segfault when the post-dominator tree is empty (ie, there are no return
authorChris Lattner <sabre@nondot.org>
Mon, 15 Sep 2003 15:47:40 +0000 (15:47 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Sep 2003 15:47:40 +0000 (15:47 +0000)
or unwind instructions in the function)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8537 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/PostDominators.h

index f7131f2a45e47948246adcd84b9e05470f678bad..8463136ea19986a91072caa402de6827c73f1ec4 100644 (file)
@@ -88,7 +88,8 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
     Frontiers.clear();
     PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
     Roots = DT.getRoots();
-    calculate(DT, DT.getRootNode());
+    if (const DominatorTree::Node *Root = DT.getRootNode())
+      calculate(DT, Root);
     return false;
   }