diff mbox

[PINGv2] ASan phase place change

Message ID 54FFF226.1070203@samsung.com
State New
Headers show

Commit Message

Marat Zakirov March 11, 2015, 7:43 a.m. UTC
On 03/03/2015 10:36 AM, Marat Zakirov wrote:
>
> On 02/24/2015 03:49 PM, Marat Zakirov wrote:
>>
>> On 02/20/2015 03:07 PM, Jakub Jelinek wrote:
>>> On Fri, Feb 20, 2015 at 02:59:51PM +0300, Marat Zakirov wrote:
>>>> Here is simple patch that moves asan phase just behind sanopt for all
>>>> O0/O1/O2/O3 modes which gives +7% on x86 SPEC2006 (ref dataset).
>>>> Regression testing and sanitized GCC bootstrapping were 
>>>> successfully done.
>>> This isn't a regression, so I think it isn't appropriate for stage 4.
>>>
>>> I bet the difference is mainly vectorization.  I believe the right
>>> change is to teach the vectorizer about the ASAN_CHECK internal call
>>> instead.
>>>
>>>     Jakub
>>>
>> Jakub,
>>
>> I reproduced +28% for 433.milk with "-fno-tree-vectorize" on ref 
>> data. Are there some other GCC vectorization options? And why do you 
>> think that performance difference caused only by vectorization? As an 
>> example In llvm loop hoisting suffers from early asan phase 
>> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-December/046332.html.
>>
>> --Marat
>
PATCH       REF        PERCENT
400.perlbench            1319       1334       1.14%
401.bzip2                700        718        2.57%
403.gcc                  586        618        5.46%
429.mcf                  435        521        19.77%
445.gobmk                720        750        4.17%
456.hmmer                815        816        0.12%
458.sjeng                890        919        3.26%
462.libquantum           327        347        6.12%
464.h264ref              1353       1600       18.26%
471.omnetpp              738        730        -1.08%
473.astar                536        544        1.49%
483.xalancbmk            544        615        13.05%
410.bwaves               1939       1938       -0.05%
416.gamess               3201       3202       0.03%
433.milc                 419        540        28.88%
434.zeusmp               1641       1641       0.00%
435.gromacs              923        938        1.63%
436.cactusADM            2970       2973       0.10%
437.leslie3d             1564       1588       1.53%
444.namd                 484        490        1.24%
447.dealII               591        676        14.38%
450.soplex               320        348        8.75%
453.povray               322        328        1.86%
459.GemsFDTD             1921       1950       1.51%
465.tonto                1621       1641       1.23%
470.lbm                  252        337        33.73%
482.sphinx3              656        943        43.75%
GEOMEAN                                        7.07%

Comments

Yury Gribov March 11, 2015, 7:46 a.m. UTC | #1
On 03/11/2015 10:43 AM, Marat Zakirov wrote:
>
> On 03/03/2015 10:36 AM, Marat Zakirov wrote:
>>
>> On 02/24/2015 03:49 PM, Marat Zakirov wrote:
>>>
>>> On 02/20/2015 03:07 PM, Jakub Jelinek wrote:
>>>> On Fri, Feb 20, 2015 at 02:59:51PM +0300, Marat Zakirov wrote:
>>>>> Here is simple patch that moves asan phase just behind sanopt for all
>>>>> O0/O1/O2/O3 modes which gives +7% on x86 SPEC2006 (ref dataset).
>>>>> Regression testing and sanitized GCC bootstrapping were
>>>>> successfully done.
>>>> This isn't a regression, so I think it isn't appropriate for stage 4.
>>>>
>>>> I bet the difference is mainly vectorization.  I believe the right
>>>> change is to teach the vectorizer about the ASAN_CHECK internal call
>>>> instead.
>>>>
>>>>     Jakub
>>>>
>>> Jakub,
>>>
>>> I reproduced +28% for 433.milk with "-fno-tree-vectorize" on ref
>>> data. Are there some other GCC vectorization options? And why do you
>>> think that performance difference caused only by vectorization? As an
>>> example In llvm loop hoisting suffers from early asan phase
>>> http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-December/046332.html.

I think it would help if we could analyze where performance improvements 
are coming from. You can check Max's presentation for inspiration 
(http://www.youtube.com/watch?v=qTDBHJsWDHw).

-Y
diff mbox

Patch

gcc/ChangeLog:

2015-02-20  Marat Zakirov  <m.zakirov@samsung.com>

	* asan.c (make_pass_asan_O0): Pass remove.
	* passes.def: Change place for ASan pass.
	* tree-pass.h: Passes remove.
	* tsan.c (make_pass_tsan_O0): Pass remove.


gcc/testsuite/ChangeLog:

2015-02-20  Marat Zakirov  <m.zakirov@samsung.com>

	* c-c++-common/asan/inc.c: Fix option.

diff --git a/gcc/asan.c b/gcc/asan.c
index b7c2b11..001d79e 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2796,40 +2796,4 @@  make_pass_asan (gcc::context *ctxt)
   return new pass_asan (ctxt);
 }
 
-namespace {
-
-const pass_data pass_data_asan_O0 =
-{
-  GIMPLE_PASS, /* type */
-  "asan0", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_NONE, /* tv_id */
-  ( PROP_ssa | PROP_cfg | PROP_gimple_leh ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_update_ssa, /* todo_flags_finish */
-};
-
-class pass_asan_O0 : public gimple_opt_pass
-{
-public:
-  pass_asan_O0 (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_asan_O0, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *) { return !optimize && gate_asan (); }
-  virtual unsigned int execute (function *) { return asan_instrument (); }
-
-}; // class pass_asan_O0
-
-} // anon namespace
-
-gimple_opt_pass *
-make_pass_asan_O0 (gcc::context *ctxt)
-{
-  return new pass_asan_O0 (ctxt);
-}
-
 #include "gt-asan.h"
diff --git a/gcc/passes.def b/gcc/passes.def
index 2bc5dcd..398d8dc 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -214,8 +214,6 @@  along with GCC; see the file COPYING3.  If not see
       NEXT_PASS (pass_split_crit_edges);
       NEXT_PASS (pass_pre);
       NEXT_PASS (pass_sink_code);
-      NEXT_PASS (pass_asan);
-      NEXT_PASS (pass_tsan);
       /* Pass group that runs when 1) enabled, 2) there are loops
 	 in the function.  Make sure to run pass_fix_loops before
 	 to discover/remove loops before running the gate function
@@ -344,8 +342,8 @@  along with GCC; see the file COPYING3.  If not see
   NEXT_PASS (pass_vtable_verify);
   NEXT_PASS (pass_lower_vector);
   NEXT_PASS (pass_lower_complex_O0);
-  NEXT_PASS (pass_asan_O0);
-  NEXT_PASS (pass_tsan_O0);
+  NEXT_PASS (pass_asan);
+  NEXT_PASS (pass_tsan);
   NEXT_PASS (pass_sanopt);
   NEXT_PASS (pass_cleanup_eh);
   NEXT_PASS (pass_lower_resx);
diff --git a/gcc/testsuite/c-c++-common/asan/inc.c b/gcc/testsuite/c-c++-common/asan/inc.c
index 36cc3d8..8c38150 100644
--- a/gcc/testsuite/c-c++-common/asan/inc.c
+++ b/gcc/testsuite/c-c++-common/asan/inc.c
@@ -1,4 +1,4 @@ 
-/* { dg-options "-fdump-tree-asan0" } */
+/* { dg-options "-fdump-tree-asan" } */
 /* { dg-do compile } */
 /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
 
@@ -16,6 +16,6 @@  main ()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "ASAN_" 1 "asan0" } }  */
-/* { dg-final { scan-tree-dump "ASAN_CHECK \\(.*, 4\\);" "asan0" } }  */
-/* { dg-final { cleanup-tree-dump "asan0" } } */
+/* { dg-final { scan-tree-dump-times "ASAN_" 1 "asan" } }  */
+/* { dg-final { scan-tree-dump "ASAN_CHECK \\(.*, 4\\);" "asan" } }  */
+/* { dg-final { cleanup-tree-dump "asan" } } */
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index b59ae7a..50cbf85 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -339,9 +339,7 @@  extern simple_ipa_opt_pass *make_pass_ipa_chkp_produce_thunks (gcc::context *ctx
 extern gimple_opt_pass *make_pass_chkp (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_chkp_opt (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_asan (gcc::context *ctxt);
-extern gimple_opt_pass *make_pass_asan_O0 (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_tsan (gcc::context *ctxt);
-extern gimple_opt_pass *make_pass_tsan_O0 (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_lower_cf (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_refactor_eh (gcc::context *ctxt);
 extern gimple_opt_pass *make_pass_lower_eh (gcc::context *ctxt);
diff --git a/gcc/tsan.c b/gcc/tsan.c
index ae89d5f..a9dca1f 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -882,44 +882,3 @@  make_pass_tsan (gcc::context *ctxt)
   return new pass_tsan (ctxt);
 }
 
-namespace {
-
-const pass_data pass_data_tsan_O0 =
-{
-  GIMPLE_PASS, /* type */
-  "tsan0", /* name */
-  OPTGROUP_NONE, /* optinfo_flags */
-  TV_NONE, /* tv_id */
-  ( PROP_ssa | PROP_cfg ), /* properties_required */
-  0, /* properties_provided */
-  0, /* properties_destroyed */
-  0, /* todo_flags_start */
-  TODO_update_ssa, /* todo_flags_finish */
-};
-
-class pass_tsan_O0 : public gimple_opt_pass
-{
-public:
-  pass_tsan_O0 (gcc::context *ctxt)
-    : gimple_opt_pass (pass_data_tsan_O0, ctxt)
-  {}
-
-  /* opt_pass methods: */
-  virtual bool gate (function *)
-    {
-      return ((flag_sanitize & SANITIZE_THREAD) != 0 && !optimize
-	      && !lookup_attribute ("no_sanitize_thread",
-				    DECL_ATTRIBUTES (current_function_decl)));
-    }
-
-  virtual unsigned int execute (function *) { return tsan_pass (); }
-
-}; // class pass_tsan_O0
-
-} // anon namespace
-
-gimple_opt_pass *
-make_pass_tsan_O0 (gcc::context *ctxt)
-{
-  return new pass_tsan_O0 (ctxt);
-}