From 96f962fdffab615f196ea6b66ea736ca2c601548 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 28 Mar 2011 23:02:18 +0000 Subject: In some cases, the "fail BB dominator" may be null after the BB was split (and becomes reachable when before it wasn't). Check to make sure that it's not null before trying to use it. llvm-svn: 128434 --- llvm/lib/CodeGen/StackProtector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/StackProtector.cpp') diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 02d8fd6dea96..1a588e25d6e3 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -221,7 +221,8 @@ bool StackProtector::InsertStackProtectors() { BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return"); if (DT && DT->isReachableFromEntry(BB)) { DT->addNewBlock(NewBB, BB); - FailBBDom = DT->findNearestCommonDominator(FailBBDom, BB); + if (FailBBDom) + FailBBDom = DT->findNearestCommonDominator(FailBBDom, BB); } // Remove default branch instruction to the new BB. -- cgit v1.2.3