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]

PR tree-optimization/30443


Hi,
the update of clonning code to cleanup has caused us to ICE in quite
rare cases when cleanup_cfg or folding iterate and we decide to save
function body (since the cgraph edges are not updated afterwards and
thus we get extra edge in the cgraph clone).  This reproduce during
bootstrap on cygwin and darwing.

I've fixed it by disabling the optimizations for inlining cloning (but
kept it for constant propagation), bootstrapped/regtested i686-linux and
comitted.
I apologize for the breakage - it didn't show up during Linux testing.

	PR tree-optimization/30443
	* tree-inline.c (tree_function_versioning): Do not optimize when
	cloning for inlining.
Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 120681)
--- tree-inline.c	(working copy)
*************** tree_function_versioning (tree old_decl,
*** 3209,3224 ****
    DECL_ARTIFICIAL (new_decl) = 1;
    DECL_ABSTRACT_ORIGIN (new_decl) = DECL_ORIGIN (old_decl);
  
    /* Generate a new name for the new version. */
    if (!update_clones)
      {
        DECL_NAME (new_decl) =  create_tmp_var_name (NULL);
        SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
        SET_DECL_RTL (new_decl, NULL_RTX);
      }
- 
-   /* Prepare the data structures for the tree copy.  */
-   memset (&id, 0, sizeof (id));
    
    id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
    id.src_fn = old_decl;
--- 3209,3225 ----
    DECL_ARTIFICIAL (new_decl) = 1;
    DECL_ABSTRACT_ORIGIN (new_decl) = DECL_ORIGIN (old_decl);
  
+   /* Prepare the data structures for the tree copy.  */
+   memset (&id, 0, sizeof (id));
+ 
    /* Generate a new name for the new version. */
    if (!update_clones)
      {
        DECL_NAME (new_decl) =  create_tmp_var_name (NULL);
        SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
        SET_DECL_RTL (new_decl, NULL_RTX);
+       id.statements_to_fold = pointer_set_create ();
      }
    
    id.decl_map = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
    id.src_fn = old_decl;
*************** tree_function_versioning (tree old_decl,
*** 3233,3239 ****
    id.transform_new_cfg = true;
    id.transform_return_to_modify = false;
    id.transform_lang_insert_block = false;
-   id.statements_to_fold = pointer_set_create ();
  
    current_function_decl = new_decl;
    old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION
--- 3234,3239 ----
*************** tree_function_versioning (tree old_decl,
*** 3299,3316 ****
  
    /* Clean up.  */
    splay_tree_delete (id.decl_map);
!   fold_marked_statements (0, id.statements_to_fold);
!   pointer_set_destroy (id.statements_to_fold);
!   fold_cond_expr_cond ();
    if (gimple_in_ssa_p (cfun))
      {
        free_dominance_info (CDI_DOMINATORS);
        free_dominance_info (CDI_POST_DOMINATORS);
!       delete_unreachable_blocks ();
        update_ssa (TODO_update_ssa);
!       fold_cond_expr_cond ();
!       if (need_ssa_update_p ())
!         update_ssa (TODO_update_ssa);
      }
    free_dominance_info (CDI_DOMINATORS);
    free_dominance_info (CDI_POST_DOMINATORS);
--- 3299,3323 ----
  
    /* Clean up.  */
    splay_tree_delete (id.decl_map);
!   if (!update_clones)
!     {
!       fold_marked_statements (0, id.statements_to_fold);
!       pointer_set_destroy (id.statements_to_fold);
!       fold_cond_expr_cond ();
!     }
    if (gimple_in_ssa_p (cfun))
      {
        free_dominance_info (CDI_DOMINATORS);
        free_dominance_info (CDI_POST_DOMINATORS);
!       if (!update_clones)
!         delete_unreachable_blocks ();
        update_ssa (TODO_update_ssa);
!       if (!update_clones)
! 	{
! 	  fold_cond_expr_cond ();
! 	  if (need_ssa_update_p ())
! 	    update_ssa (TODO_update_ssa);
! 	}
      }
    free_dominance_info (CDI_DOMINATORS);
    free_dominance_info (CDI_POST_DOMINATORS);


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