[PATCH] more regmove dead code

Paolo Bonzini bonzini@gnu.org
Wed Feb 25 17:12:00 GMT 2009


Also following post-IRA cleanup, the first half of regmove_optimize has
this interesting structure:

  for (pass = 0; pass <= 2; pass++)
    {
      if (! flag_regmove && pass >= flag_expensive_optimizations)
       goto done;

      ...

      for (...)
        {
          /* some transformations here... */
        }
    }

where:

1) flag_regmove is always true, so the first if never triggers;

2) all the code in /* some transformations here... */ is guarded by
"flag_expensive_optimizations && ! pass", making the second pass is
totally useless.

So the entire code is equivalent to:

  if (flag_expensive_optimizations)
    {
      for (...)
        {
          /* some transformations here... */
        }
    }

Now, protecting code to only run under flag_expensive_optimizations is
dubious for anything that only runs at optimize >= 2 (so
flag_expensive_optimizations is on by default), but that's something for
a different patch.  And it makes the attached patch nice and readable,
since it does not change the indentation of the code.

It does remove one walk of the insn stream, so it's better than nothing
WRT compilation time.  And it makes adaptation of regmove to cfglayout
mode much simpler.

I made a little unrelated change, by removing the now-trivially-useless
rest_of_handle_regmove wrapper.

Ok for trunk or 4.5, at the discretion of the reviewer?

Paolo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: regmove-expensive-opts.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090225/338f870c/attachment.ksh>


More information about the Gcc-patches mailing list