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

Cameron Zwarich zwarich at apple.com
Tue Mar 29 00:37:31 PDT 2011


On 2011-03-29, at 12:34 AM, Bill Wendling wrote:

> On Mar 29, 2011, at 12:24 AM, Cameron Zwarich wrote:
> 
>> On 2011-03-29, at 12:06 AM, Bill Wendling wrote:
>> 
>>> On Mar 28, 2011, at 10:35 PM, Eli Friedman wrote:
>>> 
>>>> On Mon, Mar 28, 2011 at 10:15 PM, Bill Wendling <isanbard at gmail.com> wrote:
>>>> 
>>>> That isn't a safe way to query whether a block is usable... if you
>>>> have domtree, why not just use "DT->isReachableFromEntry(BB)"?
>>>> 
>>> It's probably rather slow. Why isn't this safe?
>> 
>> You can have an unreachable loop. Using isReachableFromEntry() was fast the last time I checked. It just checks whether the BB has a DomTreeNode.
>> 
> Ah! Okay. (Though it seems like the isReachableFromEntry could call a slower routine, or maybe I misread it...) Well, the logic was gross and didn't work anyway. So I reworked it. It should now work and be less gross.

Yeah, it does a dominance check even though it doesn't have to. Why not move the dominator check below here so that it is executed less often?

    ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator());
    if (!RI) continue;

Also, if you're going to just skip unreachable blocks, then you should probably remove the reachability checks later on in the function.

Cameron



More information about the llvm-commits mailing list