This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Loop analysis
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: David Edelsohn <dje at watson dot ibm dot com>
- Cc: Diego Novillo <dnovillo at redhat dot com>, Jason Merrill <jason at redhat dot com>,Jan Hubicka <jh at suse dot cz>,"gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 9 May 2003 22:04:34 +0200
- Subject: Re: [tree-ssa] Loop analysis
- References: <dnovillo@redhat.com> <1052503377.5149.224.camel@frodo.toronto.redhat.com> <200305091810.OAA27324@makai.watson.ibm.com>
On Fri, May 09, 2003 at 02:10:51PM -0400, David Edelsohn wrote:
> My initial question was a simple "Why?" Maybe I should have been
> clearer and asked: "Was this by design?" ... "Was this intentional?"
>
I placed the code there for having the loop information before going into
SSA. I have worked on an analyzer that is based on the loops structure
and that doesn't suppose the code in SSA form ("Monotonic Evolution",
Peng Wu and Albert Cohen).
The SSA transformation does not change the loops informations, and
thus you can use this information from this point and as long as the CFG is
not modified by major reordering that could delete some loops. DCE is one of
the optimizers that is susceptible to delete loops and BBs in loops bodies.
In principle it would be interesting (as pointed out by Jan) to keep the CFG
structure, as well as the loops structure live during the tree to RTL translation.
This would allow a CFG guided translation that could save some cycles.
> It is important to know whether there is a technical reason for
> the design or whether it is just a placeholder. There are no comments in
> the patch or in the code to clarify this.
>
Sorry for the inconvenient, what about the following patch?
* tree-optimize.c (optimize_function_tree): Clarify the use of the
loop analyzer.
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-optimize.c,v
retrieving revision 1.1.4.37
diff -d -u -p -r1.1.4.37 tree-optimize.c
--- tree-optimize.c 28 Apr 2003 03:36:57 -0000 1.1.4.37
+++ tree-optimize.c 9 May 2003 19:41:15 -0000
@@ -65,7 +65,14 @@ optimize_function_tree (fndecl)
{
#if 0
struct loops *loops;
+
+ /* The loop analyzer should be initialized after the CFG construction. */
loops = loop_optimizer_init (NULL);
+
+ /* For the moment the loops structure is not used. If you use this
+ structure you'll have to ensure that optimizers don't invalidate the
+ information gathered in the loops structure via modifications to the
+ underlying structure: the CFG. */
loop_optimizer_finalize (loops, NULL);
#endif
/* Rewrite the function into SSA form. */