diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-03-29 05:15:48 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-03-29 05:15:48 +0000 |
commit | ad7d8a598b17452138c20f7a7acdcd7e1f0053d8 (patch) | |
tree | 4c32b03b260396ab41881f40000bfad7821c42e9 /lib/CodeGen | |
parent | 0f4158790916352a52f105dbfb638c9a0db00321 (diff) | |
download | external_llvm-ad7d8a598b17452138c20f7a7acdcd7e1f0053d8.zip external_llvm-ad7d8a598b17452138c20f7a7acdcd7e1f0053d8.tar.gz external_llvm-ad7d8a598b17452138c20f7a7acdcd7e1f0053d8.tar.bz2 |
Don't try to add stack protector logic to a dead basic block. It messes up
dominator information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/StackProtector.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp index 1a588e2..d90cb39 100644 --- a/lib/CodeGen/StackProtector.cpp +++ b/lib/CodeGen/StackProtector.cpp @@ -150,9 +150,11 @@ bool StackProtector::InsertStackProtectors() { BasicBlock *FailBBDom = 0; // FailBB's dominator. AllocaInst *AI = 0; // Place on stack that stores the stack guard. Value *StackGuardVar = 0; // The stack guard variable. + BasicBlock &Entry = F->getEntryBlock(); for (Function::iterator I = F->begin(), E = F->end(); I != E; ) { BasicBlock *BB = I++; + if (BB->getNumUses() == 0 && BB != &Entry) continue; ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()); if (!RI) continue; @@ -178,7 +180,6 @@ bool StackProtector::InsertStackProtectors() { StackGuardVar = M->getOrInsertGlobal("__stack_chk_guard", PtrTy); } - BasicBlock &Entry = F->getEntryBlock(); Instruction *InsPt = &Entry.front(); AI = new AllocaInst(PtrTy, "StackGuardSlot", InsPt); |