From c72b249e9cb2f6c89fe3008bb8d1f49468bf5657 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 15 Sep 2003 15:47:40 +0000 Subject: [PATCH] Do not segfault when the post-dominator tree is empty (ie, there are no return 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index f7131f2a45e..8463136ea19 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -88,7 +88,8 @@ struct PostDominanceFrontier : public DominanceFrontierBase { Frontiers.clear(); PostDominatorTree &DT = getAnalysis(); Roots = DT.getRoots(); - calculate(DT, DT.getRootNode()); + if (const DominatorTree::Node *Root = DT.getRootNode()) + calculate(DT, Root); return false; } -- 2.34.1