[Bug tree-optimization/19098] New: tree-ssa-dom.c has an "if" statement whose condition is probably wrong

Jeffrey A Law law@redhat.com
Tue Dec 28 06:34:00 GMT 2004


On Tue, 2004-12-21 at 05:59 +0000, kazu at cs dot umass dot edu wrote:
> tree-ssa-dom.c has the following
> 
>       if (!e->flags & EDGE_DFS_BACK)
> 
> which is always 0 because !e->flags is always 0 or 1, and
> EDGE_DFS_BACK is 32.
Ugh.  To do this right is going to take quite a bit more work.  More
work than I suspect this problem is worth.  I goof'd the implementation
of the trivial tests mentioned in my last message.  That goof made it
appear that the trivial tests were sufficient.  They are definitely
not sufficient.

Doing this right requires us to know the threading status of all the 
edges into the loop header.  ie, we can't determine in tree-ssa-dom.c
if threading across a loop header is safe or not.  All tree-ssa-dom.c
can do is record the jump thread opportunity and leave it to 
tree-ssa-threadupdate.c to determine if the opportunity should be
realized.

Given that the code as it stands does nothing and will have to be
removed if we are going to really solve this problem, I'm just going
to remove it for 4.0.

If we find that we're creating irreducible regions and those are 
causing runtime performance issues, then we'll have to attack
the tree-ssa-threadupdate.c side of the problem in the 4.1 or
later timeframe.


Bootstrapped and regression tested on i686-pc-linux-gnu.


-------------- next part --------------
	* tree-ssa-dom.c (thread_across_edge): Remove broken code to
	avoid threading into a loop.

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.80
diff -c -p -r2.80 tree-ssa-dom.c
*** tree-ssa-dom.c	13 Dec 2004 20:12:33 -0000	2.80
--- tree-ssa-dom.c	28 Dec 2004 06:24:18 -0000
*************** thread_across_edge (struct dom_walk_data
*** 686,707 ****
  	  || TREE_CODE (stmt) == SWITCH_EXPR))
      {
        tree cond, cached_lhs;
-       edge e1;
-       edge_iterator ei;
- 
-       /* Do not forward entry edges into the loop.  In the case loop
- 	 has multiple entry edges we may end up in constructing irreducible
- 	 region.  
- 	 ??? We may consider forwarding the edges in the case all incoming
- 	 edges forward to the same destination block.  */
-       if (!e->flags & EDGE_DFS_BACK)
- 	{
- 	  FOR_EACH_EDGE (e1, ei, e->dest->preds)
- 	    if (e1->flags & EDGE_DFS_BACK)
- 	      break;
- 	  if (e1)
- 	    return;
- 	}
  
        /* Now temporarily cprop the operands and try to find the resulting
  	 expression in the hash tables.  */
--- 686,691 ----


More information about the Gcc-patches mailing list