[debuglocus] fix vectorizer and mudflap sharing

Aldy Hernandez aldyh@redhat.com
Thu Apr 23 22:24:00 GMT 2009


This patch fixes the remaining debuglocus sharing violations.  We can
now bootstrap with no testsuite regressions, while forcing sharing
verification.

Andrew, I've made create_duplicate_debuglocus() work with plain location
entries, and just return the location.  This simplifies things a bit.  I
can change the caller to do the check if you prefer.

[I've been thinking that perhaps it's better to have
gimple_set_location() accept a boolean specifying whether to to call
create_duplicate_debuglocus() automatically.  Also, what do you think
about checking for duplicate entries by default and aborting-- at least
during development.]

OK for branch?

Aldy

	* debuglocus.c (create_duplicate_debuglocus): Allow non debuglocus
	entries.
	* tree-mudflap.c (mf_build_check_statement_for): Duplicate debuglocus
	entries.
	(mx_register_decls): Same.
	* tree-vect-transform.c (vect_finish_stmt_generation): Same.

Index: debuglocus.c
===================================================================
--- debuglocus.c	(revision 146577)
+++ debuglocus.c	(working copy)
@@ -297,14 +297,17 @@ debuglocus_from_pointer (debuglocus_p dl
 
 
 /* Copy the debuglocus LOCUS. This requires duplicating the debuglocus, as well
-   as any chain of debuglocus's attached to it.  */
+   as any chain of debuglocus's attached to it.
+
+   If the LOCUS is not a debuglocus, just return the LOCUS.  */
 source_location
 create_duplicate_debuglocus (source_location locus)
 {
   int root_i, new_i, src_i, dest_i, prev_dest_i;
   debuglocus_p root_p, new_p, src_p, dest_p, prev_dest_p;
 
-  gcc_assert (is_debuglocus (locus));
+  if (!is_debuglocus (locus))
+    return locus;
 
   root_i = DEBUGLOCUS_INDEX (locus);   /* Root is the locus being copied.  */
   root_p = get_debuglocus_entry (current_debuglocus_table (), root_i);
Index: tree-mudflap.c
===================================================================
--- tree-mudflap.c	(revision 146206)
+++ tree-mudflap.c	(working copy)
@@ -555,6 +555,7 @@ mf_build_check_statement_for (tree base,
   t = fold_convert (mf_uintptr_type, unshare_expr (base));
   gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
   g = gimple_build_assign (mf_base, t);
+  location = create_duplicate_debuglocus (location);
   gimple_set_location (g, location);
   gimple_seq_add_stmt (&seq, g);
 
@@ -562,6 +563,7 @@ mf_build_check_statement_for (tree base,
   t = fold_convert (mf_uintptr_type, unshare_expr (limit));
   gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
   g = gimple_build_assign (mf_limit, t);
+  location = create_duplicate_debuglocus (location);
   gimple_set_location (g, location);
   gimple_seq_add_stmt (&seq, g);
 
@@ -579,6 +581,7 @@ mf_build_check_statement_for (tree base,
   t = build1 (ADDR_EXPR, mf_cache_structptr_type, t);
   gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
   g = gimple_build_assign (mf_elem, t);
+  location = create_duplicate_debuglocus (location);
   gimple_set_location (g, location);
   gimple_seq_add_stmt (&seq, g);
 
@@ -625,6 +628,7 @@ mf_build_check_statement_for (tree base,
   gimplify_expr (&t, &seq, &seq, is_gimple_reg_rhs, fb_rvalue);
   cond = create_tmp_var (boolean_type_node, "__mf_unlikely_cond");
   g = gimple_build_assign  (cond, t);
+  location = create_duplicate_debuglocus (location);
   gimple_set_location (g, location);
   gimple_seq_add_stmt (&seq, g);
 
@@ -632,6 +636,7 @@ mf_build_check_statement_for (tree base,
      simply build a void COND_EXPR.  We do need labels in both arms though.  */
   g = gimple_build_cond (NE_EXPR, cond, integer_zero_node, NULL_TREE,
 			 NULL_TREE);
+  location = create_duplicate_debuglocus (location);
   gimple_set_location (g, location);
   gimple_seq_add_stmt (&seq, g);
 
@@ -1048,7 +1053,9 @@ mx_register_decls (tree decl, gimple_seq
 	  
 
           /* Accumulate the two calls.  */
+	  location = create_duplicate_debuglocus (location);
 	  gimple_set_location (register_fncall, location);
+	  location = create_duplicate_debuglocus (location);
 	  gimple_set_location (unregister_fncall, location);
 
           /* Add the __mf_register call at the current appending point.  */
Index: tree-vect-transform.c
===================================================================
--- tree-vect-transform.c	(revision 146206)
+++ tree-vect-transform.c	(working copy)
@@ -2174,6 +2174,7 @@ vect_finish_stmt_generation (gimple stmt
 {
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
   loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
+  location_t dlocus;
 
   gcc_assert (gimple_code (stmt) != GIMPLE_LABEL);
 
@@ -2187,7 +2188,8 @@ vect_finish_stmt_generation (gimple stmt
       print_gimple_stmt (vect_dump, vec_stmt, 0, TDF_SLIM);
     }
 
-  gimple_set_location (vec_stmt, gimple_location (gsi_stmt (*gsi)));
+  dlocus = create_duplicate_debuglocus (gimple_location (gsi_stmt (*gsi)));
+  gimple_set_location (vec_stmt, dlocus);
 }
 
 



More information about the Gcc-patches mailing list