Patchwork [tsan] Don't instrument clobber stmts, minor cleanups

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 23, 2012, 1:39 p.m.
Message ID <20121123133924.GW2315@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/201321/
State New
Headers show

Comments

Jakub Jelinek - Nov. 23, 2012, 1:39 p.m.
Hi!

 var ={v} {CLOBBER};
stmts shouldn't be tsan instrumented, those aren't stores, just
markups that var's scope ends.  Additionally this patch removes the
IMHO unneeded TODO_update_address_taken (discussed earlier already)
and fixes formatting of a few comments.

Ok for trunk?

2012-11-23  Jakub Jelinek  <jakub@redhat.com>

	* tsan.c: Fix up comment formatting.
	(instrument_gimple): Ignore gimple_clobber_p stmts.
	(pass_tsan, pass_tsan_O0): Remove TODO_update_address_taken
	from todo_flags_finish.


	Jakub
Richard Guenther - Nov. 25, 2012, 1:36 p.m.
On Fri, Nov 23, 2012 at 2:39 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
>  var ={v} {CLOBBER};
> stmts shouldn't be tsan instrumented, those aren't stores, just
> markups that var's scope ends.  Additionally this patch removes the
> IMHO unneeded TODO_update_address_taken (discussed earlier already)
> and fixes formatting of a few comments.
>
> Ok for trunk?

Ok.

Thanks,
Richard.

> 2012-11-23  Jakub Jelinek  <jakub@redhat.com>
>
>         * tsan.c: Fix up comment formatting.
>         (instrument_gimple): Ignore gimple_clobber_p stmts.
>         (pass_tsan, pass_tsan_O0): Remove TODO_update_address_taken
>         from todo_flags_finish.
>
> --- gcc/tsan.c.jj       2012-11-23 10:31:37.000000000 +0100
> +++ gcc/tsan.c  2012-11-23 13:35:06.448082211 +0100
> @@ -107,7 +107,7 @@ is_load_of_const_p (tree expr, bool is_w
>  }
>
>  /* Instruments EXPR if needed. If any instrumentation is inserted,
> - * return true. */
> +   return true.  */
>
>  static bool
>  instrument_expr (gimple_stmt_iterator gsi, tree expr, bool is_write)
> @@ -161,7 +161,7 @@ instrument_expr (gimple_stmt_iterator gs
>        || bitsize != size * BITS_PER_UNIT)
>      return false;
>
> -  /* TODO: handle other case: ARRAY_RANGE_REF. */
> +  /* TODO: handle other case: ARRAY_RANGE_REF.  */
>    if (tcode != ARRAY_REF
>        && tcode != VAR_DECL
>        && tcode != COMPONENT_REF
> @@ -197,7 +197,7 @@ instrument_expr (gimple_stmt_iterator gs
>      {
>        /* If the call can throw, it must be the last stmt in
>          a basic block, so the instrumented stmts need to be
> -        inserted in successor bbs. */
> +        inserted in successor bbs.  */
>        if (is_ctrl_altering_stmt (stmt))
>         {
>           edge e;
> @@ -217,7 +217,7 @@ instrument_expr (gimple_stmt_iterator gs
>  }
>
>  /* Instruments the gimple pointed to by GSI. Return
> - * true if func entry/exit should be instrumented. */
> +   true if func entry/exit should be instrumented.  */
>
>  static bool
>  instrument_gimple (gimple_stmt_iterator gsi)
> @@ -231,7 +231,8 @@ instrument_gimple (gimple_stmt_iterator
>        && (gimple_call_fndecl (stmt)
>           != builtin_decl_implicit (BUILT_IN_TSAN_INIT)))
>      return true;
> -  else if (is_gimple_assign (stmt))
> +  else if (is_gimple_assign (stmt)
> +          && !gimple_clobber_p (stmt))
>      {
>        if (gimple_store_p (stmt))
>         {
> @@ -248,7 +249,7 @@ instrument_gimple (gimple_stmt_iterator
>  }
>
>  /* Instruments all interesting memory accesses in the current function.
> - * Return true if func entry/exit should be instrumented. */
> +   Return true if func entry/exit should be instrumented.  */
>
>  static bool
>  instrument_memory_accesses (void)
> @@ -372,8 +373,7 @@ struct gimple_opt_pass pass_tsan =
>    0,                                   /* properties_provided  */
>    0,                                   /* properties_destroyed  */
>    0,                                   /* todo_flags_start  */
> -  TODO_verify_all | TODO_update_ssa
> -  | TODO_update_address_taken          /* todo_flags_finish  */
> +  TODO_verify_all | TODO_update_ssa    /* todo_flags_finish  */
>   }
>  };
>
> @@ -399,7 +399,6 @@ struct gimple_opt_pass pass_tsan_O0 =
>    0,                                   /* properties_provided  */
>    0,                                   /* properties_destroyed  */
>    0,                                   /* todo_flags_start  */
> -  TODO_verify_all | TODO_update_ssa
> -  | TODO_update_address_taken          /* todo_flags_finish  */
> +  TODO_verify_all | TODO_update_ssa    /* todo_flags_finish  */
>   }
>  };
>
>         Jakub

Patch

--- gcc/tsan.c.jj	2012-11-23 10:31:37.000000000 +0100
+++ gcc/tsan.c	2012-11-23 13:35:06.448082211 +0100
@@ -107,7 +107,7 @@  is_load_of_const_p (tree expr, bool is_w
 }
 
 /* Instruments EXPR if needed. If any instrumentation is inserted,
- * return true. */
+   return true.  */
 
 static bool
 instrument_expr (gimple_stmt_iterator gsi, tree expr, bool is_write)
@@ -161,7 +161,7 @@  instrument_expr (gimple_stmt_iterator gs
       || bitsize != size * BITS_PER_UNIT)
     return false;
 
-  /* TODO: handle other case: ARRAY_RANGE_REF. */
+  /* TODO: handle other case: ARRAY_RANGE_REF.  */
   if (tcode != ARRAY_REF
       && tcode != VAR_DECL
       && tcode != COMPONENT_REF
@@ -197,7 +197,7 @@  instrument_expr (gimple_stmt_iterator gs
     {
       /* If the call can throw, it must be the last stmt in
 	 a basic block, so the instrumented stmts need to be
-	 inserted in successor bbs. */
+	 inserted in successor bbs.  */
       if (is_ctrl_altering_stmt (stmt))
 	{
 	  edge e;
@@ -217,7 +217,7 @@  instrument_expr (gimple_stmt_iterator gs
 }
 
 /* Instruments the gimple pointed to by GSI. Return
- * true if func entry/exit should be instrumented. */
+   true if func entry/exit should be instrumented.  */
 
 static bool
 instrument_gimple (gimple_stmt_iterator gsi)
@@ -231,7 +231,8 @@  instrument_gimple (gimple_stmt_iterator
       && (gimple_call_fndecl (stmt)
 	  != builtin_decl_implicit (BUILT_IN_TSAN_INIT)))
     return true;
-  else if (is_gimple_assign (stmt))
+  else if (is_gimple_assign (stmt)
+	   && !gimple_clobber_p (stmt))
     {
       if (gimple_store_p (stmt))
 	{
@@ -248,7 +249,7 @@  instrument_gimple (gimple_stmt_iterator
 }
 
 /* Instruments all interesting memory accesses in the current function.
- * Return true if func entry/exit should be instrumented. */
+   Return true if func entry/exit should be instrumented.  */
 
 static bool
 instrument_memory_accesses (void)
@@ -372,8 +373,7 @@  struct gimple_opt_pass pass_tsan =
   0,					/* properties_provided  */
   0,					/* properties_destroyed  */
   0,					/* todo_flags_start  */
-  TODO_verify_all | TODO_update_ssa
-  | TODO_update_address_taken		/* todo_flags_finish  */
+  TODO_verify_all | TODO_update_ssa	/* todo_flags_finish  */
  }
 };
 
@@ -399,7 +399,6 @@  struct gimple_opt_pass pass_tsan_O0 =
   0,					/* properties_provided  */
   0,					/* properties_destroyed  */
   0,					/* todo_flags_start  */
-  TODO_verify_all | TODO_update_ssa
-  | TODO_update_address_taken		/* todo_flags_finish  */
+  TODO_verify_all | TODO_update_ssa	/* todo_flags_finish  */
  }
 };