summaryrefslogtreecommitdiff
path: root/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-03-11 21:51:56 +0000
committerCameron Zwarich <zwarich@apple.com>2011-03-11 21:51:56 +0000
commit53aac15a607d66926e586c7fc57634f6be4ef443 (patch)
tree7aa7a1d2a1082ed275d50a136df6b2a620bf7e71 /lib/CodeGen/StackProtector.cpp
parent2ce5bf188dfa4329eb246df6011dd1edde5a5979 (diff)
downloadllvm-53aac15a607d66926e586c7fc57634f6be4ef443.tar.gz
llvm-53aac15a607d66926e586c7fc57634f6be4ef443.tar.bz2
llvm-53aac15a607d66926e586c7fc57634f6be4ef443.tar.xz
Fix the GCC test suite issue exposed by r127477, which was caused by stack
protector insertion not working correctly with unreachable code. Since that revision was rolled out, this test doesn't actual fail before this fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127497 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackProtector.cpp')
-rw-r--r--lib/CodeGen/StackProtector.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp
index fcaee4208b..02d8fd6dea 100644
--- a/lib/CodeGen/StackProtector.cpp
+++ b/lib/CodeGen/StackProtector.cpp
@@ -219,8 +219,8 @@ bool StackProtector::InsertStackProtectors() {
// Split the basic block before the return instruction.
BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return");
- if (DT) {
- DT->addNewBlock(NewBB, DT->isReachableFromEntry(BB) ? BB : 0);
+ if (DT && DT->isReachableFromEntry(BB)) {
+ DT->addNewBlock(NewBB, BB);
FailBBDom = DT->findNearestCommonDominator(FailBBDom, BB);
}
@@ -242,7 +242,7 @@ bool StackProtector::InsertStackProtectors() {
// statements in the function.
if (!FailBB) return false;
- if (DT)
+ if (DT && FailBBDom)
DT->addNewBlock(FailBB, FailBBDom);
return true;