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]

[tree-ssa] Thread around to top of loop


Originally I was preventing the jump threader from threading around
to the top of a loop.  I couldn't see how that would be useful and
it had caused some problems in early implementations (probably due to
the latent rewriter bug that got fixed last week).

Not surprisingly 2 of the remaining 13 cases where the tree-ssa code
is missing a jump threading opportunity are due to not allowing us
to thread around to the start of a loop.  Consider something like this:



             while (chain_p)
                {
                  data_type = concat (data_type,
                        IDENTIFIER_POINTER (TREE_PURPOSE (chain_p)), NULL);
                  chain_p = TREE_CHAIN (chain_p);
                  if (chain_p)
                    data_type = concat (data_type, ", ", NULL);
                }
 

The conditional guarding the second call to concat is the same conditional
which guards the next iteration of the loop.


This patch removes the bogus restriction on the threader.  It bootstraps
and regression tests on i686-pc-linux-gnu.



	* tree-ssa-dom.c (thread_across_edge): Remove bogus restriction
	which prevents threading around to the top of a loop.

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.117
diff -c -p -r1.1.2.117 tree-ssa-dom.c
*** tree-ssa-dom.c	21 Jan 2004 08:37:28 -0000	1.1.2.117
--- tree-ssa-dom.c	21 Jan 2004 15:13:43 -0000
*************** thread_across_edge (struct dom_walk_data
*** 791,801 ****
        tree cond, cached_lhs;
        edge e1;
  
-       /* Do not forward a back edge in the CFG.  This avoids short circuiting
- 	 loops and other similar undesirable behavior.  */
-       if (e->flags & EDGE_DFS_BACK)
- 	return;
- 
        /* Do not forward entry edges into the loop.  In the case loop
  	 has multiple entry edges we may end up in constructing irreducible
  	 region.  
--- 791,796 ----



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