On 10/18/2011 07:10 AM, Jeff Law wrote:
--- 467,475 ----
         if (gimple_code (use) != GIMPLE_PHI)
        {
          sinkbb = gimple_bb (use);
!         sinkbb = select_best_block (frombb, gimple_bb (use), stmt);

!         if (sinkbb == frombb)
            return false;

          *togsi = gsi_for_stmt (use);

Useless assignment of sinkbb, otherwise looks fine.

By the way, is it intended that sink_code_in_bb visits again postdominators that were already visited (which with domwalk would come for free)? As it is, the pass is quadratic when you have something like this:

  if (x1) y; else z;
  if (x2) y; else z;
  ...
  if (x9999) y; else z;
  if (x10000) y; else z;

where the postdominator tree is

             x1
              |
             x2
              |
           x9999
              |
           x10000 y1 z1 y2 z2 ... y10000 z10000
               \___|__|__|__|______/__,---'
                          |
                      EXIT_BLOCK

Paolo

Reply via email to