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] Minor bug in cddce


When cddce found a dead conditional it would remove all the edges from
the block containing the conditional, then create a new edge from the
block containing the conditional to its postdominator.

Later we called phi_arg_from_edge on PHI nodes in that post dominator
with the newly created edge.  phi_arg_from_edge was unable to find the
desired edge and things went downhill after that.

The correct way to deal with this is to redirect one of the existing
edges, then remove the remaining edges.  Which is precisely what this
patch does.  That also happens to be more memory efficient as well
(though I doubt it matters in any significant way).

This should fix two aborts/ICEs when building Fedora Core 2-test1 from
source.  We've got a build pass rate of 81% -- and that's without fixing
the numerous packages that are failing due to removal of the cast-as-lvalue
extension.


	* tree-ssa-dce.c (remove_dead_stmt): Redirect an existing edge
	rather than deleting the old ones and creating a new one when
	removing a dead conditional.

	* testsuite/gcc.c-torture/compile/20040304-1.c: New test.


Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dce.c,v
retrieving revision 1.1.2.80
diff -c -p -r1.1.2.80 tree-ssa-dce.c
*** tree-ssa-dce.c	25 Feb 2004 03:22:47 -0000	1.1.2.80
--- tree-ssa-dce.c	4 Mar 2004 23:19:31 -0000
*************** remove_dead_stmt (block_stmt_iterator *i
*** 693,707 ****
  	  return;
  	}
  
!       /* Remove all outgoing edges, and add an edge to the post dominator.  
*/
!       for (e = bb->succ; e != NULL;)
  	{
  	  edge tmp = e;
  	  e = e->succ_next;
  	  remove_edge (tmp);
  	}
-       make_edge (bb, post_dom_bb,
- 		 (post_dom_bb == EXIT_BLOCK_PTR ? 0 : EDGE_FALLTHRU));
      }
  
    bsi_remove (i);
--- 693,720 ----
  	  return;
  	}
  
!       /* Redirect the first edge out of BB to reach POST_DOM_BB.  */
!       redirect_edge_and_branch (bb->succ, post_dom_bb);
! 
!       /* The edge is no longer associated with a conditional, so it does
! 	 not have TRUE/FALSE flags.  */
!       bb->succ->flags &= ~(EDGE_TRUE_VALUE | EDGE_FALSE_VALUE);
! 
!       /* If the edge reaches any block other than the exit, then it is a
! 	 fallthru edge; if it reaches the exit, then it is not a fallthru
! 	 edge.  */
!       if (post_dom_bb != EXIT_BLOCK_PTR)
! 	bb->succ->flags |= EDGE_FALLTHRU;
!       else
! 	bb->succ->flags &= ~EDGE_FALLTHRU;
! 
!       /* Remove the remaining the outgoing edges.  */
!       for (e = bb->succ->succ_next; e != NULL;)
  	{
  	  edge tmp = e;
  	  e = e->succ_next;
  	  remove_edge (tmp);
  	}
      }
  
    bsi_remove (i);

Index: testsuite/gcc.c-torture/compile/20040304-1.c
===================================================================
RCS file: testsuite/gcc.c-torture/compile/20040304-1.c
diff -N testsuite/gcc.c-torture/compile/20040304-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.c-torture/compile/20040304-1.c	4 Mar 2004 23:18:30 -0000
***************
*** 0 ****
--- 1,20 ----
+ void
+ cpplib_macroExpand (char * pfile)
+ {
+   int nargs;
+   int rest_args;
+   int token = -1;
+   rest_args = 0;
+   do
+     {
+       if (rest_args != 0)
+           continue;
+       if (nargs == 0)
+         {
+           rest_args = 1;
+           token = macarg (pfile, rest_args);
+         }
+     }
+   while (token == 20);
+ }
+ 






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