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: PR19038 causes regression of 3.9% in SPEC int


On Wednesday 29 December 2004 21:21, Jeffrey A Law wrote:
> On Wed, 2004-12-29 at 20:40 +0100, Steven Bosscher wrote:
> > On Wednesday 29 December 2004 20:19, Jeffrey A Law wrote:
> > > Well, this ought to fix the poor placement of the copy instruction.
> >
> > Cool.  One question, don't you need a call to mark_dfs_back_edges()
> > somewhere?
>
> They should have been marked much earlier in the tree-ssa path.
>
> They can get slightly out-of-date which would at worst cause us to
> not apply this optimization when it was appropriate or apply it
> when it was not necessary -- neither of which should generate
> incorrect code.

*sigh* We really seem to think completely differently about sanity
of a compiler algorithms...

Of course it wouldn't result in wrong code, but it does lead to odd
situations where some change to the source code would cause such a
missed optimization and result in completely unexpected changes in
the generated code.  IMVHO we should avoid such situations, and the
cost of marking back edges is almost nothing (especially compared
to some other tree-ssa passes.

Also note that the second tail call optimizations pass, one of the
passes that may create back edges, is run after the last DCE pass,
which is the last pass to mark back edges.

But oh well you are the boss...  Mind if I add this comment so at
least it's clear that not calling mark_dfs_back_edges is deliberate?

Gr.
Steven


Index: tree-outof-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-outof-ssa.c,v
retrieving revision 2.38
diff -u -r2.38 tree-outof-ssa.c
--- tree-outof-ssa.c    29 Dec 2004 19:21:07 -0000      2.38
+++ tree-outof-ssa.c    29 Dec 2004 23:19:13 -0000
@@ -2369,7 +2369,13 @@

    Insert a copy from the PHI argument to a new destination at the
    end of the block with the backedge to the top of the loop.  Update
-   the PHI argument to reference this new destination.  */
+   the PHI argument to reference this new destination.
+
+   ??? The EDGE_DFS_BACK flag is set on edges by mark_dfs_back_edges()
+   earlier in earlier passes.  The flags can get slightly out-of-date,
+   but that should never result in wrong code - just in a handful of
+   missed optimizations.  We probably need to look into new out-of-ssa
+   algorithms for GCC 4.1 anyway, maybe revisit this function then, too.  */

 static void
 insert_backedge_copies (void)


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