public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* IPA merge: make fixup_cfg to deal with SSA
@ 2006-12-28 19:41 Jan Hubicka
  2006-12-29  1:12 ` Jan Hubicka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Hubicka @ 2006-12-28 19:41 UTC (permalink / raw)
  To: gcc-patches, dnovillo

Hi,
this patch makes execute_fixup_cfg to work fluently in all side cases on SSA.
There are two extra cases to care on SSA: when new edges to nonlocal goto
receivers are added, the appropriate PHI node has to be updated. THe update_ssa
has to be called manually (instead of using TODO flag) as fixup_cfg is used
with and without optimizing.  This is probably cleaner than making
tree-optimize to silently ignore the flag when function don't seem to be in SSA
or having two fixup passes (SSA and non-SSA one).

While debugging the problem I also noticed that DECL_NOTHROW is set incorrectly
and additionally after_inlining flag is set too late so we hit some false
sanity checks in update_ssa.

Bootstrapped/regtested i686-linux without IPA-SSA and x86_64-linux with
IPA-SSA.  OK?

Honza

	* tree-optimize (execute_fixup_cfg): Set after_inlining flag;
	set NOTHROW flag on call statements proved to be nothrow;
	update statement of local calls so new pure/const functions are
	updated; update_ssa when in ssa form; mark PHI nodes of nonlocal
	goto receivers.
	(tree_rest_of_compilation): Register hooks and initialize bitmap
	early; do not set after_inlining flag.
Index: tree-optimize.c
===================================================================
*** tree-optimize.c	(revision 120209)
--- tree-optimize.c	(working copy)
*************** execute_fixup_cfg (void)
*** 264,269 ****
--- 318,325 ----
    basic_block bb;
    block_stmt_iterator bsi;
  
+   cfun->after_inlining = true;
+ 
    if (cfun->eh)
      FOR_EACH_BB (bb)
        {
*************** execute_fixup_cfg (void)
*** 271,279 ****
  	  {
  	    tree stmt = bsi_stmt (bsi);
  	    tree call = get_call_expr_in (stmt);
  
! 	    if (call && call_expr_flags (call) & (ECF_CONST | ECF_PURE))
! 	      TREE_SIDE_EFFECTS (call) = 0;
  	    if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
  	      remove_stmt_from_eh_region (stmt);
  	  }
--- 327,342 ----
  	  {
  	    tree stmt = bsi_stmt (bsi);
  	    tree call = get_call_expr_in (stmt);
+ 	    tree decl = call ? get_callee_fndecl (call) : NULL;
  
! 	    if (decl && call_expr_flags (call) & (ECF_CONST | ECF_PURE)
! 		&& TREE_SIDE_EFFECTS (call))
! 	      {
! 	        update_stmt (stmt);
! 	        TREE_SIDE_EFFECTS (call) = 0;
! 	      }
! 	    if (decl && TREE_NOTHROW (decl))
! 	      TREE_NOTHROW (call) = 1;
  	    if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
  	      remove_stmt_from_eh_region (stmt);
  	  }
*************** execute_fixup_cfg (void)
*** 281,309 ****
        }
  
    if (current_function_has_nonlocal_label)
!     FOR_EACH_BB (bb)
!       {
! 	for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! 	  {
! 	    tree stmt = bsi_stmt (bsi);
! 	    if (tree_can_make_abnormal_goto (stmt))
! 	      {
! 		if (stmt == bsi_stmt (bsi_last (bb)))
! 		  {
! 		    if (!has_abnormal_outgoing_edge_p (bb))
  		      make_abnormal_goto_edges (bb, true);
! 		  }
! 		else
! 		  {
! 		    edge e = split_block (bb, stmt);
! 		    bb = e->src;
! 		    make_abnormal_goto_edges (bb, true);
! 		  }
! 		break;
! 	      }
! 	  }
!       }
  
    cleanup_tree_cfg ();
  
    /* Dump a textual representation of the flowgraph.  */
--- 344,398 ----
        }
  
    if (current_function_has_nonlocal_label)
!     {
!       FOR_EACH_BB (bb)
! 	{
! 	  for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! 	    {
! 	      tree stmt = bsi_stmt (bsi);
! 	      if (tree_can_make_abnormal_goto (stmt))
! 		{
! 		  if (stmt == bsi_stmt (bsi_last (bb)))
! 		    {
! 		      if (!has_abnormal_outgoing_edge_p (bb))
! 			make_abnormal_goto_edges (bb, true);
! 		    }
! 		  else
! 		    {
! 		      edge e = split_block (bb, stmt);
! 		      bb = e->src;
  		      make_abnormal_goto_edges (bb, true);
! 		    }
! 		  break;
! 		}
! 
! 	      /* Update PHIs on nonlocal goto receivers we (possibly)
! 		 just created new edges into.  */
! 	      if (TREE_CODE (stmt) == LABEL_EXPR
! 		  && gimple_in_ssa_p (cfun))
! 		{
! 		  tree target = LABEL_EXPR_LABEL (stmt);
! 		  if (DECL_NONLOCAL (target))
! 		    {
! 		      tree phi;
! 		      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
! 			{
! 			  gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI
! 				      (PHI_RESULT (phi)));
! 			  mark_sym_for_renaming
! 			    (SSA_NAME_VAR (PHI_RESULT (phi)));
! 			}
! 		    }
! 		}
! 	    }
! 	}
!     }
  
+   if (gimple_in_ssa_p (cfun))
+     {
+       delete_unreachable_blocks ();
+       update_ssa (TODO_update_ssa);
+     }
    cleanup_tree_cfg ();
  
    /* Dump a textual representation of the flowgraph.  */
*************** tree_rest_of_compilation (tree fndecl)
*** 408,413 ****
--- 508,516 ----
  
    node = cgraph_node (fndecl);
  
+   /* Initialize the default bitmap obstack.  */
+   bitmap_obstack_initialize (NULL);
+ 
    /* We might need the body of this function so that we can expand
       it inline somewhere else.  */
    if (cgraph_preserve_function_body_p (fndecl))
*************** tree_rest_of_compilation (tree fndecl)
*** 424,430 ****
       We haven't necessarily assigned RTL to all variables yet, so it's
       not safe to try to expand expressions involving them.  */
    cfun->x_dont_save_pending_sizes_p = 1;
!   cfun->after_inlining = true;
  
    if (flag_inline_trees)
      {
--- 527,534 ----
       We haven't necessarily assigned RTL to all variables yet, so it's
       not safe to try to expand expressions involving them.  */
    cfun->x_dont_save_pending_sizes_p = 1;
!   
!   tree_register_cfg_hooks ();
  
    if (flag_inline_trees)
      {
*************** tree_rest_of_compilation (tree fndecl)
*** 453,464 ****
       Kill it so it won't confuse us.  */
    cgraph_node_remove_callees (node);
  
- 
-   /* Initialize the default bitmap obstack.  */
-   bitmap_obstack_initialize (NULL);
    bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
-   
-   tree_register_cfg_hooks ();
    /* Perform all tree transforms and optimizations.  */
    execute_pass_list (all_passes);
    
--- 557,563 ----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: IPA merge: make fixup_cfg to deal with SSA
  2006-12-28 19:41 IPA merge: make fixup_cfg to deal with SSA Jan Hubicka
@ 2006-12-29  1:12 ` Jan Hubicka
  2007-01-02 20:36   ` Roger Sayle
  2007-01-05  2:03   ` Jan Hubicka
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Hubicka @ 2006-12-29  1:12 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, dnovillo

> Hi,
> this patch makes execute_fixup_cfg to work fluently in all side cases on SSA.
> There are two extra cases to care on SSA: when new edges to nonlocal goto
> receivers are added, the appropriate PHI node has to be updated. THe update_ssa
> has to be called manually (instead of using TODO flag) as fixup_cfg is used
> with and without optimizing.  This is probably cleaner than making
> tree-optimize to silently ignore the flag when function don't seem to be in SSA
> or having two fixup passes (SSA and non-SSA one).

As Andrew reminded me, we can do that with returning TODO flags from
execute functions.  Bootstrapped/regtested with IPA-SSA on x86_64-linux,
mainline bootstrap/regtesting running on i686-linux, OK if it passes?
> 
> Honza
> 
	* tree-optimize (execute_fixup_cfg): Set after_inlining flag;
	set NOTHROW flag on call statements proved to be nothrow;
	update statement of local calls so new pure/const functions are
	updated; update_ssa when in ssa form; mark PHI nodes of nonlocal
	goto receivers.
	(tree_rest_of_compilation): Register hooks and initialize bitmap
	(pass_fixup_cfg): Add appropriate TODOs.


Index: tree-optimize.c
===================================================================
*** tree-optimize.c	(revision 120209)
--- tree-optimize.c	(working copy)
*************** execute_fixup_cfg (void)
*** 263,268 ****
--- 317,325 ----
  {
    basic_block bb;
    block_stmt_iterator bsi;
+   int todo = gimple_in_ssa_p (cfun) ? TODO_verify_ssa : 0;
+ 
+   cfun->after_inlining = true;
  
    if (cfun->eh)
      FOR_EACH_BB (bb)
*************** execute_fixup_cfg (void)
*** 271,279 ****
  	  {
  	    tree stmt = bsi_stmt (bsi);
  	    tree call = get_call_expr_in (stmt);
  
! 	    if (call && call_expr_flags (call) & (ECF_CONST | ECF_PURE))
! 	      TREE_SIDE_EFFECTS (call) = 0;
  	    if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
  	      remove_stmt_from_eh_region (stmt);
  	  }
--- 328,347 ----
  	  {
  	    tree stmt = bsi_stmt (bsi);
  	    tree call = get_call_expr_in (stmt);
+ 	    tree decl = call ? get_callee_fndecl (call) : NULL;
  
! 	    if (decl && call_expr_flags (call) & (ECF_CONST | ECF_PURE)
! 		&& TREE_SIDE_EFFECTS (call))
! 	      {
! 		if (gimple_in_ssa_p (cfun))
! 		  {
! 		    todo |= TODO_update_ssa;
! 	            update_stmt (stmt);
! 		  }
! 	        TREE_SIDE_EFFECTS (call) = 0;
! 	      }
! 	    if (decl && TREE_NOTHROW (decl))
! 	      TREE_NOTHROW (call) = 1;
  	    if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
  	      remove_stmt_from_eh_region (stmt);
  	  }
*************** execute_fixup_cfg (void)
*** 281,316 ****
        }
  
    if (current_function_has_nonlocal_label)
!     FOR_EACH_BB (bb)
!       {
! 	for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! 	  {
! 	    tree stmt = bsi_stmt (bsi);
! 	    if (tree_can_make_abnormal_goto (stmt))
! 	      {
! 		if (stmt == bsi_stmt (bsi_last (bb)))
! 		  {
! 		    if (!has_abnormal_outgoing_edge_p (bb))
  		      make_abnormal_goto_edges (bb, true);
! 		  }
! 		else
! 		  {
! 		    edge e = split_block (bb, stmt);
! 		    bb = e->src;
! 		    make_abnormal_goto_edges (bb, true);
! 		  }
! 		break;
! 	      }
! 	  }
!       }
! 
!   cleanup_tree_cfg ();
  
    /* Dump a textual representation of the flowgraph.  */
    if (dump_file)
      dump_tree_cfg (dump_file, dump_flags);
  
!   return 0;
  }
  
  struct tree_opt_pass pass_fixup_cfg =
--- 349,405 ----
        }
  
    if (current_function_has_nonlocal_label)
!     {
!       FOR_EACH_BB (bb)
! 	{
! 	  for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! 	    {
! 	      tree stmt = bsi_stmt (bsi);
! 	      if (tree_can_make_abnormal_goto (stmt))
! 		{
! 		  if (stmt == bsi_stmt (bsi_last (bb)))
! 		    {
! 		      if (!has_abnormal_outgoing_edge_p (bb))
! 			make_abnormal_goto_edges (bb, true);
! 		    }
! 		  else
! 		    {
! 		      edge e = split_block (bb, stmt);
! 		      bb = e->src;
  		      make_abnormal_goto_edges (bb, true);
! 		    }
! 		  break;
! 		}
! 
! 	      /* Update PHIs on nonlocal goto receivers we (possibly)
! 		 just created new edges into.  */
! 	      if (TREE_CODE (stmt) == LABEL_EXPR
! 		  && gimple_in_ssa_p (cfun))
! 		{
! 		  tree target = LABEL_EXPR_LABEL (stmt);
! 		  if (DECL_NONLOCAL (target))
! 		    {
! 		      tree phi;
! 
! 		      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
! 			{
! 		          todo |= TODO_update_ssa;
! 			  gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI
! 				      (PHI_RESULT (phi)));
! 			  mark_sym_for_renaming
! 			    (SSA_NAME_VAR (PHI_RESULT (phi)));
! 			}
! 		    }
! 		}
! 	    }
! 	}
!     }
  
    /* Dump a textual representation of the flowgraph.  */
    if (dump_file)
      dump_tree_cfg (dump_file, dump_flags);
  
!   return todo;
  }
  
  struct tree_opt_pass pass_fixup_cfg =
*************** struct tree_opt_pass pass_fixup_cfg =
*** 326,334 ****
    0,					/* properties_provided */
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
!   0,					/* todo_flags_finish */
!   0					/* letter */
! };
  
  /* Do the actions required to initialize internal data structures used
     in tree-ssa optimization passes.  */
--- 415,424 ----
    0,					/* properties_provided */
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
!   TODO_cleanup_cfg | TODO_ggc_collect
!   | TODO_dump_func | TODO_verify_flow
!   | TODO_verify_stmts,		/* todo_flags_finish */
!   0					/* letter */ };
  
  /* Do the actions required to initialize internal data structures used
     in tree-ssa optimization passes.  */
*************** tree_rest_of_compilation (tree fndecl)
*** 408,413 ****
--- 509,517 ----
  
    node = cgraph_node (fndecl);
  
+   /* Initialize the default bitmap obstack.  */
+   bitmap_obstack_initialize (NULL);
+ 
    /* We might need the body of this function so that we can expand
       it inline somewhere else.  */
    if (cgraph_preserve_function_body_p (fndecl))
*************** tree_rest_of_compilation (tree fndecl)
*** 424,430 ****
       We haven't necessarily assigned RTL to all variables yet, so it's
       not safe to try to expand expressions involving them.  */
    cfun->x_dont_save_pending_sizes_p = 1;
!   cfun->after_inlining = true;
  
    if (flag_inline_trees)
      {
--- 528,535 ----
       We haven't necessarily assigned RTL to all variables yet, so it's
       not safe to try to expand expressions involving them.  */
    cfun->x_dont_save_pending_sizes_p = 1;
!   
!   tree_register_cfg_hooks ();
  
    if (flag_inline_trees)
      {
*************** tree_rest_of_compilation (tree fndecl)
*** 453,464 ****
       Kill it so it won't confuse us.  */
    cgraph_node_remove_callees (node);
  
- 
-   /* Initialize the default bitmap obstack.  */
-   bitmap_obstack_initialize (NULL);
    bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
-   
-   tree_register_cfg_hooks ();
    /* Perform all tree transforms and optimizations.  */
    execute_pass_list (all_passes);
    
--- 558,564 ----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: IPA merge: make fixup_cfg to deal with SSA
  2006-12-29  1:12 ` Jan Hubicka
@ 2007-01-02 20:36   ` Roger Sayle
  2007-01-05  2:03   ` Jan Hubicka
  1 sibling, 0 replies; 7+ messages in thread
From: Roger Sayle @ 2007-01-02 20:36 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, dnovillo


On Fri, 29 Dec 2006, Jan Hubicka wrote:
>
> 	* tree-optimize (execute_fixup_cfg): Set after_inlining flag;
> 	set NOTHROW flag on call statements proved to be nothrow;
> 	update statement of local calls so new pure/const functions are
> 	updated; update_ssa when in ssa form; mark PHI nodes of nonlocal
> 	goto receivers.
> 	(tree_rest_of_compilation): Register hooks and initialize bitmap
> 	(pass_fixup_cfg): Add appropriate TODOs.

This is all OK for mainline, except for some minor issues with the
ChangeLog entry.  "tree-optimize.c" and it's more usual to use full
sentences (capitalized, with periods) rather than using semicolons
as separators.

Many thanks.

Roger
--

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: IPA merge: make fixup_cfg to deal with SSA
  2006-12-29  1:12 ` Jan Hubicka
  2007-01-02 20:36   ` Roger Sayle
@ 2007-01-05  2:03   ` Jan Hubicka
  2007-01-05 10:46     ` Andreas Schwab
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Hubicka @ 2007-01-05  2:03 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, gcc-patches, dnovillo

> > Hi,
> > this patch makes execute_fixup_cfg to work fluently in all side cases on SSA.
> > There are two extra cases to care on SSA: when new edges to nonlocal goto
> > receivers are added, the appropriate PHI node has to be updated. THe update_ssa
> > has to be called manually (instead of using TODO flag) as fixup_cfg is used
> > with and without optimizing.  This is probably cleaner than making
> > tree-optimize to silently ignore the flag when function don't seem to be in SSA
> > or having two fixup passes (SSA and non-SSA one).
> 
> As Andrew reminded me, we can do that with returning TODO flags from
> execute functions.  Bootstrapped/regtested with IPA-SSA on x86_64-linux,
> mainline bootstrap/regtesting running on i686-linux, OK if it passes?

Actually I just noticed I amanged to pick wrong version of patch while
comitting.  The attached patch (bootstrapped/regtested i686-linux)
compensate that and my apologizes for the noise.

Honza

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 120468)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2007-01-04  Jan Hubicka  <jh@suse.cz>
+
+	* tree-optimize.c (execute_fixup_cfg): Correct previously mistakely
+	comitted older version of patch.
+	(pass_fixup_cfg): Add TODOs to verify flow and statements, dump
+	function, celanup cfg and collect garbage.
+
 2007-01-04  Mike Stump  <mrs@apple.com>
 
 	* Makefile.in (mostlyclean): Don't remove libgcc anymore.
Index: tree-optimize.c
===================================================================
--- tree-optimize.c	(revision 120468)
+++ tree-optimize.c	(working copy)
@@ -297,6 +297,7 @@ execute_fixup_cfg (void)
 {
   basic_block bb;
   block_stmt_iterator bsi;
+  int todo = gimple_in_ssa_p (cfun) ? TODO_verify_ssa : 0;
 
   cfun->after_inlining = true;
 
@@ -312,7 +313,11 @@ execute_fixup_cfg (void)
 	    if (decl && call_expr_flags (call) & (ECF_CONST | ECF_PURE)
 		&& TREE_SIDE_EFFECTS (call))
 	      {
-	        update_stmt (stmt);
+		if (gimple_in_ssa_p (cfun))
+		  {
+		    todo |= TODO_update_ssa;
+	            update_stmt (stmt);
+		  }
 	        TREE_SIDE_EFFECTS (call) = 0;
 	      }
 	    if (decl && TREE_NOTHROW (decl))
@@ -355,8 +360,10 @@ execute_fixup_cfg (void)
 		  if (DECL_NONLOCAL (target))
 		    {
 		      tree phi;
+
 		      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
 			{
+		          todo |= TODO_update_ssa;
 			  gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI
 				      (PHI_RESULT (phi)));
 			  mark_sym_for_renaming
@@ -368,18 +375,11 @@ execute_fixup_cfg (void)
 	}
     }
 
-  if (gimple_in_ssa_p (cfun))
-    {
-      delete_unreachable_blocks ();
-      update_ssa (TODO_update_ssa);
-    }
-  cleanup_tree_cfg ();
-
   /* Dump a textual representation of the flowgraph.  */
   if (dump_file)
     dump_tree_cfg (dump_file, dump_flags);
 
-  return 0;
+  return todo;
 }
 
 struct tree_opt_pass pass_fixup_cfg =
@@ -395,9 +395,10 @@ struct tree_opt_pass pass_fixup_cfg =
   0,					/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
-  0,					/* todo_flags_finish */
-  0					/* letter */
-};
+  TODO_cleanup_cfg | TODO_ggc_collect
+  | TODO_dump_func | TODO_verify_flow
+  | TODO_verify_stmts,/* todo_flags_finish */
+  0					/* letter */ };
 
 /* Do the actions required to initialize internal data structures used
    in tree-ssa optimization passes.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: IPA merge: make fixup_cfg to deal with SSA
  2007-01-05  2:03   ` Jan Hubicka
@ 2007-01-05 10:46     ` Andreas Schwab
  2007-01-05 11:13       ` Jan Hubicka
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2007-01-05 10:46 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Jan Hubicka, gcc-patches, dnovillo

Jan Hubicka <jh@suse.cz> writes:

> Actually I just noticed I amanged to pick wrong version of patch while
> comitting.  The attached patch (bootstrapped/regtested i686-linux)
> compensate that and my apologizes for the noise.

Doesn't bootstrap on ia64.

/tmp/cvs/gcc-20070105/Build/./prev-gcc/xgcc -B/tmp/cvs/gcc-20070105/Build/./prev-gcc/ -B/tmp/cvs/gcc-20070105/Build/root/ia64-suse-linux/bin/ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"zlib\" -DVERSION=\"1.1.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_MEMCPY=1 -DHAVE_STRERROR=1 -DHAVE_UNISTD_H=1  -I. -I../../zlib     -g -O2 -c -o libz_a-trees.o `test -f 'trees.c' || echo '../../zlib/'`trees.c
 IMM ERROR : (use_p : tree - 0x2000000000974330:0x20000000007a76f0)2
for SSA_NAME: tree_11 in statement:
D.3480_22 = D.3479_21 + tree_11;
../../zlib/trees.c: In function 'build_tree':
../../zlib/trees.c:622: internal compiler error: verify_ssa failed

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: IPA merge: make fixup_cfg to deal with SSA
  2007-01-05 10:46     ` Andreas Schwab
@ 2007-01-05 11:13       ` Jan Hubicka
  2007-01-05 12:22         ` Jan Hubicka
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Hubicka @ 2007-01-05 11:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Jan Hubicka, Jan Hubicka, gcc-patches, dnovillo

> Jan Hubicka <jh@suse.cz> writes:
> 
> > Actually I just noticed I amanged to pick wrong version of patch while
> > comitting.  The attached patch (bootstrapped/regtested i686-linux)
> > compensate that and my apologizes for the noise.
> 
> Doesn't bootstrap on ia64.
> 
> /tmp/cvs/gcc-20070105/Build/./prev-gcc/xgcc -B/tmp/cvs/gcc-20070105/Build/./prev-gcc/ -B/tmp/cvs/gcc-20070105/Build/root/ia64-suse-linux/bin/ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"zlib\" -DVERSION=\"1.1.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_MEMCPY=1 -DHAVE_STRERROR=1 -DHAVE_UNISTD_H=1  -I. -I../../zlib     -g -O2 -c -o libz_a-trees.o `test -f 'trees.c' || echo '../../zlib/'`trees.c
>  IMM ERROR : (use_p : tree - 0x2000000000974330:0x20000000007a76f0)2
> for SSA_NAME: tree_11 in statement:

Hi,
there is interesting memory corruption related to inliner's folding not
updating statements that has changed their operands.  I am testing the
attached patch, hopefully it will help for ia-64 too.

	* tree-inline.c (fold_marked_statements): After folding update
	operand caches and EH info.
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 120468)
+++ tree-inline.c	(working copy)
@@ -2597,7 +2597,15 @@ fold_marked_statements (int first, struc
 	for (bsi = bsi_start (BASIC_BLOCK (first));
 	     !bsi_end_p (bsi); bsi_next (&bsi))
 	  if (pointer_set_contains (statements, bsi_stmt (bsi)))
-	    fold_stmt (bsi_stmt_ptr (bsi));
+	    {
+	      tree old_stmt = bsi_stmt (bsi);
+	      if (fold_stmt (bsi_stmt_ptr (bsi)))
+		{
+		  update_stmt (bsi_stmt (bsi));
+		  if (maybe_clean_or_replace_eh_stmt (old_stmt, bsi_stmt (bsi)))
+		     tree_purge_dead_eh_edges (BASIC_BLOCK (first));
+		}
+	    }
       }
 }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: IPA merge: make fixup_cfg to deal with SSA
  2007-01-05 11:13       ` Jan Hubicka
@ 2007-01-05 12:22         ` Jan Hubicka
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Hubicka @ 2007-01-05 12:22 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Andreas Schwab, Jan Hubicka, gcc-patches, dnovillo

> 
> 	* tree-inline.c (fold_marked_statements): After folding update
> 	operand caches and EH info.

Hi,
since I noticed same problem happens on i686/x86-64 machines in some
configuration too, I've bootstrapped/regtested the patch on i686 (where
the failure didn't happen previously) and tested it gets me past the
faiulre point and commited as obvios, so bootstrap should work again.

My apologizes for the problem - somehow I assumed that fold_stmt is
responsible for all the work on folding the stmt and other uses don't do
this. It is mostly because they are folding statements with no operand
caches built yet, unlike the inliner case where we polutate operand
caches when updating SSA.

Honza
> Index: tree-inline.c
> ===================================================================
> --- tree-inline.c	(revision 120468)
> +++ tree-inline.c	(working copy)
> @@ -2597,7 +2597,15 @@ fold_marked_statements (int first, struc
>  	for (bsi = bsi_start (BASIC_BLOCK (first));
>  	     !bsi_end_p (bsi); bsi_next (&bsi))
>  	  if (pointer_set_contains (statements, bsi_stmt (bsi)))
> -	    fold_stmt (bsi_stmt_ptr (bsi));
> +	    {
> +	      tree old_stmt = bsi_stmt (bsi);
> +	      if (fold_stmt (bsi_stmt_ptr (bsi)))
> +		{
> +		  update_stmt (bsi_stmt (bsi));
> +		  if (maybe_clean_or_replace_eh_stmt (old_stmt, bsi_stmt (bsi)))
> +		     tree_purge_dead_eh_edges (BASIC_BLOCK (first));
> +		}
> +	    }
>        }
>  }
>  

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-01-05 12:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-28 19:41 IPA merge: make fixup_cfg to deal with SSA Jan Hubicka
2006-12-29  1:12 ` Jan Hubicka
2007-01-02 20:36   ` Roger Sayle
2007-01-05  2:03   ` Jan Hubicka
2007-01-05 10:46     ` Andreas Schwab
2007-01-05 11:13       ` Jan Hubicka
2007-01-05 12:22         ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).