[llvm-commits] [llvm] r128452 - /llvm/trunk/lib/CodeGen/StackProtector.cpp

Eli Friedman eli.friedman at gmail.com
Mon Mar 28 22:35:21 PDT 2011


On Mon, Mar 28, 2011 at 10:15 PM, Bill Wendling <isanbard at gmail.com> wrote:
> Author: void
> Date: Tue Mar 29 00:15:48 2011
> New Revision: 128452
>
> URL: http://llvm.org/viewvc/llvm-project?rev=128452&view=rev
> Log:
> Don't try to add stack protector logic to a dead basic block. It messes up
> dominator information.
>
> Modified:
>    llvm/trunk/lib/CodeGen/StackProtector.cpp
>
> Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=128452&r1=128451&r2=128452&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)
> +++ llvm/trunk/lib/CodeGen/StackProtector.cpp Tue Mar 29 00:15:48 2011
> @@ -150,9 +150,11 @@
>   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;

That isn't a safe way to query whether a block is usable... if you
have domtree, why not just use "DT->isReachableFromEntry(BB)"?

-Eli




More information about the llvm-commits mailing list