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]

Mudflap cleanup


Hi,
I sent this change already together with the patch to switch into SSA as I
convinced myself I can't split it without introducing temporary regressions.
This was wrong, as it is rather easy ;)

The problem with mudflap is that it is executed after outof_ssa pass invalidating
SSA operand caches but before free_datastructures.  At this time the operands are
still active, but invalidated that has interesting side effect when SSA operands
infrastructure is trying to update.

The patch moves mudflap pass after free_datastructures, this needs just simple
change to tree-cfg to avoid updating ssa operands when they are not active.
update_modified_stmts is called from emit_edge_insertions code and ignoring
the update is consistent with what we do in other BSI* functions.

Bootstrapped/regtested i686-linux. OK?
Honza

2007-01-02  Jan Hubicka  <jh@suse.cz>
	* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for):
	Do not add referenced vars.
	* tree-cfg.c (update_modified_stmts): Do not update when SSA operands
	are not active.
	* passes.c (init_optimization_passes): Put mudflap_2 after
	free_datastructures.
Index: tree-mudflap.c
===================================================================
*** tree-mudflap.c	(revision 120313)
--- tree-mudflap.c	(working copy)
*************** mf_decl_cache_locals (void)
*** 460,473 ****
       globals into the cache variables.  */
    t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (mf_cache_shift_decl_l),
                mf_cache_shift_decl_l, mf_cache_shift_decl);
-   add_referenced_var (mf_cache_shift_decl);
    SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
    gimplify_to_stmt_list (&t);
    shift_init_stmts = t;
  
    t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (mf_cache_mask_decl_l),
                mf_cache_mask_decl_l, mf_cache_mask_decl);
-   add_referenced_var (mf_cache_mask_decl);
    SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl));
    gimplify_to_stmt_list (&t);
    mask_init_stmts = t;
--- 460,471 ----
*************** mf_build_check_statement_for (tree base,
*** 573,589 ****
                                              & __mf_mask].  */
    t = build2 (RSHIFT_EXPR, mf_uintptr_type, mf_base,
                (flag_mudflap_threads ? mf_cache_shift_decl : mf_cache_shift_decl_l));
-   add_referenced_var (mf_cache_shift_decl);
    t = build2 (BIT_AND_EXPR, mf_uintptr_type, t,
                (flag_mudflap_threads ? mf_cache_mask_decl : mf_cache_mask_decl_l));
-   add_referenced_var (mf_cache_mask_decl);
    t = build4 (ARRAY_REF,
                TREE_TYPE (TREE_TYPE (mf_cache_array_decl)),
                mf_cache_array_decl, t, NULL_TREE, NULL_TREE);
-   add_referenced_var (mf_cache_array_decl);
    t = build1 (ADDR_EXPR, mf_cache_structptr_type, t);
    t = build2 (GIMPLE_MODIFY_STMT, void_type_node, mf_elem, t);
-   add_referenced_var (mf_elem);
    SET_EXPR_LOCUS (t, locus);
    gimplify_to_stmt_list (&t);
    tsi_link_after (&tsi, t, TSI_CONTINUE_LINKING);
--- 571,583 ----
*************** mf_build_check_statement_for (tree base,
*** 607,613 ****
                build1 (INDIRECT_REF, mf_cache_struct_type, mf_elem),
                TYPE_FIELDS (mf_cache_struct_type), NULL_TREE);
    t = build2 (GT_EXPR, boolean_type_node, t, mf_base);
-   add_referenced_var (mf_base);
  
    /* Construct '__mf_elem->high < __mf_limit'.
  
--- 601,606 ----
Index: tree-cfg.c
===================================================================
*** tree-cfg.c	(revision 120313)
--- tree-cfg.c	(working copy)
*************** bsi_for_stmt (tree stmt)
*** 2803,2808 ****
--- 2803,2810 ----
  static inline void
  update_modified_stmts (tree t)
  {
+   if (!ssa_operands_active ())
+     return;
    if (TREE_CODE (t) == STATEMENT_LIST)
      {
        tree_stmt_iterator i;
Index: passes.c
===================================================================
*** passes.c	(revision 120313)
--- passes.c	(working copy)
*************** init_optimization_passes (void)
*** 476,483 ****
    NEXT_PASS (pass_expand_omp);
    NEXT_PASS (pass_all_optimizations);
    NEXT_PASS (pass_warn_function_noreturn);
-   NEXT_PASS (pass_mudflap_2);
    NEXT_PASS (pass_free_datastructures);
    NEXT_PASS (pass_free_cfg_annotations);
    NEXT_PASS (pass_expand);
    NEXT_PASS (pass_rest_of_compilation);
--- 476,483 ----
    NEXT_PASS (pass_expand_omp);
    NEXT_PASS (pass_all_optimizations);
    NEXT_PASS (pass_warn_function_noreturn);
    NEXT_PASS (pass_free_datastructures);
+   NEXT_PASS (pass_mudflap_2);
    NEXT_PASS (pass_free_cfg_annotations);
    NEXT_PASS (pass_expand);
    NEXT_PASS (pass_rest_of_compilation);


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