This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Speed up find_unreachable_blocks


On Mon, 21 Feb 2005 09:19:41 -0700, Jeffrey A Law <law@redhat.com> wrote:
> find_unreachable_blocks has a nice little loop like this:
> 
>   while (tos != worklist)
>     {
>       basic_block b = *--tos;
> 
>       FOR_EACH_EDGE (e, ei, b->succs)
>         if (!(e->dest->flags & BB_REACHABLE))
>           {
>             *tos++ = e->dest;
>             e->dest->flags |= BB_REACHABLE;
>           }
>     }

There may also be the (machine-specific) optimization of doing
a test-and-set-bit operation for this idiom.  At least ia32 has bts for this -
I don't know if it is profitable besides -Os, though.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]