This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: improve doloop recognition
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 16 Sep 2002 16:18:23 -0700
- Subject: Re: Patch: improve doloop recognition
- References: <7619E200-C9C7-11D6-93B1-003065C86F94@apple.com>
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>