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
This commit is contained in:
Bill Wendling
2011-03-28 23:02:18 +00:00
parent 67919b2a5b
commit 96f962fdff
2 changed files with 19 additions and 2 deletions

View File

@@ -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.