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: Patch: improve doloop recognition


Dale Johannesen <dalej@apple.com> writes:

> This addresses the optimization problem I reported here
> http://gcc.gnu.org/ml/gcc-patches/2002-09/msg00614.html
> in which CFG's forwarding forces a loop into a form which
> can't be recognized as a doloop.  Obviously the test could
> be more extensive, but AFAIK this is sufficient to catch
> all the cases that can be recognized as doloops.  Bootstrapped
> and tested on Darwin, and I've checked that real branches
> out of loops (break, etc.) do get forwarded on a later pass.

The patch itself is good, but:

- please write a ChangeLog entry
- say what platform you tested it on, see 
  http://gcc.gnu.org/cvswrite.html#testing
- please write a testcase.  If you can't think of a better way, write
  a gcc.dg testcase that is powerpc-specific and uses scan-assembler
  to look for a decrement-and-branch instruction.

> Index: cfgcleanup.c
> ===================================================================
> RCS file: /cvs/Darwin/gcc3/gcc/cfgcleanup.c,v
> retrieving revision 1.7
> diff -u -d -b -w -r1.7 cfgcleanup.c
> --- cfgcleanup.c        2002/08/26 05:39:29     1.7
> +++ cfgcleanup.c        2002/09/16 22:51:20
> @@ -515,6 +515,15 @@
> 
>                if (GET_CODE (insn) == NOTE)
>                  break;
> +
> +             /* Do not clean up branches to just past the end of a loop
> +                at this time; it can mess up the loop optimizer's
> +                recognition of some patterns. */
> +
> +             insn = PREV_INSN (target->head);
> +             if (insn && GET_CODE (insn) == NOTE
> +                   && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
> +               break;
>              }
> 
>            counter++;
> 
> 

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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