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]

Speed up find_unreachable_blocks


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;
          }
    }


While working on one of the various compile-time problems late last year
I noticed that we weren't optimizing this code very well.  In particular
we do not CSE the loads of e->dest because of various pieces of lameness
in our aliasing code.  The net result is we have more loads in this
potentially hot loop than are really necessary.

This patch manually CSE's those loads.  This gets us a small, but
measurable compile-time improvement (< .3%) for the components of
cc1 test.  It also made a measurable difference in one of the compile
time hogs I was looking at least year (15524?  15855?).

Note we have a bug filed and a test in the testsuite for this missed
optimization.

Bootstrapped and regression tested on i686-pc-linux-gnu.

Attachment: PPP
Description: Text document


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