summaryrefslogtreecommitdiff
path: root/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-03-28 23:02:18 +0000
committerBill Wendling <isanbard@gmail.com>2011-03-28 23:02:18 +0000
commit2d930db24f1d44a9d68c90cb7a1a58e76abd40da (patch)
tree261494a0eabcb3420fb3f25c73451ccbd669ab06 /lib/CodeGen/StackProtector.cpp
parenta7b8c2b6a416052bd7b48d3c0d702d266c6ac3a2 (diff)
downloadllvm-2d930db24f1d44a9d68c90cb7a1a58e76abd40da.tar.gz
llvm-2d930db24f1d44a9d68c90cb7a1a58e76abd40da.tar.bz2
llvm-2d930db24f1d44a9d68c90cb7a1a58e76abd40da.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackProtector.cpp')
-rw-r--r--lib/CodeGen/StackProtector.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp
index 02d8fd6dea..1a588e25d6 100644
--- a/lib/CodeGen/StackProtector.cpp
+++ b/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.