diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-20 20:41:38 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-20 20:41:38 +0100 |
commit | 442db27632e461ace26b61e968dfd8e7ab085e38 (patch) | |
tree | 1ea9330f0c107d992164ebdf556f86e90bdcccd7 /gcc | |
parent | 76a2bcdcd82326736301cba35250bb1a7fa841c1 (diff) | |
download | gcc-442db27632e461ace26b61e968dfd8e7ab085e38.zip gcc-442db27632e461ace26b61e968dfd8e7ab085e38.tar.gz gcc-442db27632e461ace26b61e968dfd8e7ab085e38.tar.bz2 |
re PR ipa/83506 (ICE: Segmentation fault in force_nonfallthru_and_redirect)
PR ipa/83506
* ipa-fnsummary.c (pass_data_ipa_free_fn_summary): Use 0 for
todo_flags_finish.
(pass_ipa_free_fn_summary): Add small_p private data member,
initialize to false in the ctor.
(pass_ipa_free_fn_summary::clone,
pass_ipa_free_fn_summary::set_pass_param,
pass_ipa_free_fn_summary::gate): New methods.
(pass_ipa_free_fn_summary::execute): Return TODO_remove_functions
| TODO_dump_symtab if small_p.
* passes.def: Add true parm for the existing pass_ipa_free_fn_summary
entry and add another instance of the pass with false parm after
ipa-pure-const.
* ipa-pure-const.c (pass_ipa_pure_const): Don't call
ipa_free_fn_summary here.
* gcc.dg/pr83506.c: New test.
* gcc.dg/ipa/ctor-empty-1.c: Use -fdump-ipa-free-fnsummary1 instead
of -fdump-ipa-free-fnsummary and scan in free-fnsummary1 instead of
free-fnsummary dump.
From-SVN: r255901
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/ipa-fnsummary.c | 22 | ||||
-rw-r--r-- | gcc/ipa-pure-const.c | 4 | ||||
-rw-r--r-- | gcc/passes.def | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr83506.c | 14 |
7 files changed, 62 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 617dba9..43c062e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2017-12-20 Jakub Jelinek <jakub@redhat.com> + + PR ipa/83506 + * ipa-fnsummary.c (pass_data_ipa_free_fn_summary): Use 0 for + todo_flags_finish. + (pass_ipa_free_fn_summary): Add small_p private data member, + initialize to false in the ctor. + (pass_ipa_free_fn_summary::clone, + pass_ipa_free_fn_summary::set_pass_param, + pass_ipa_free_fn_summary::gate): New methods. + (pass_ipa_free_fn_summary::execute): Return TODO_remove_functions + | TODO_dump_symtab if small_p. + * passes.def: Add true parm for the existing pass_ipa_free_fn_summary + entry and add another instance of the pass with false parm after + ipa-pure-const. + * ipa-pure-const.c (pass_ipa_pure_const): Don't call + ipa_free_fn_summary here. + 2017-12-20 Paolo Carlini <paolo.carlini@oracle.com> * gimplify.c (gimplify_return_expr): Remove dead error_mark_node check. @@ -3102,7 +3120,7 @@ * config/xtensa/xtensa.h (FRAME_GROWS_DOWNWARD): Set to 1 if ASAN is enabled. -2017-12-05 Richard Biener <rguenther@suse.de> +2017-12-05 Richard Biener <rguenther@suse.de> * timevar.def (TV_TREE_RECIP, TV_TREE_SINCOS, TV_TREE_WIDEN_MUL): Add. * tree-ssa-math-opts.c (pass_data_cse_reciprocal): Use TV_TREE_RECIP. diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index 7881151..9415031 100644 --- a/gcc/ipa-fnsummary.c +++ b/gcc/ipa-fnsummary.c @@ -3538,26 +3538,36 @@ const pass_data pass_data_ipa_free_fn_summary = 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - /* Early optimizations may make function unreachable. We can not - remove unreachable functions as part of the ealry opts pass because - TODOs are run before subpasses. Do it here. */ - ( TODO_remove_functions | TODO_dump_symtab ), /* todo_flags_finish */ + 0, /* todo_flags_finish */ }; class pass_ipa_free_fn_summary : public simple_ipa_opt_pass { public: pass_ipa_free_fn_summary (gcc::context *ctxt) - : simple_ipa_opt_pass (pass_data_ipa_free_fn_summary, ctxt) + : simple_ipa_opt_pass (pass_data_ipa_free_fn_summary, ctxt), + small_p (false) {} /* opt_pass methods: */ + opt_pass *clone () { return new pass_ipa_free_fn_summary (m_ctxt); } + void set_pass_param (unsigned int n, bool param) + { + gcc_assert (n == 0); + small_p = param; + } + virtual bool gate (function *) { return small_p || !flag_wpa; } virtual unsigned int execute (function *) { ipa_free_fn_summary (); - return 0; + /* Early optimizations may make function unreachable. We can not + remove unreachable functions as part of the early opts pass because + TODOs are run before subpasses. Do it here. */ + return small_p ? TODO_remove_functions | TODO_dump_symtab : 0; } +private: + bool small_p; }; // class pass_ipa_free_fn_summary } // anon namespace diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 22f92fc..09ca359 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -2013,10 +2013,6 @@ execute (function *) if (has_function_state (node)) free (get_function_state (node)); funct_state_vec.release (); - - /* In WPA we use inline summaries for partitioning process. */ - if (!flag_wpa) - ipa_free_fn_summary (); return remove_p ? TODO_remove_functions : 0; } diff --git a/gcc/passes.def b/gcc/passes.def index 67adae5..4607825 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -144,7 +144,7 @@ along with GCC; see the file COPYING3. If not see PUSH_INSERT_PASSES_WITHIN (pass_ipa_tree_profile) NEXT_PASS (pass_feedback_split_functions); POP_INSERT_PASSES () - NEXT_PASS (pass_ipa_free_fn_summary); + NEXT_PASS (pass_ipa_free_fn_summary, true /* small_p */); NEXT_PASS (pass_ipa_increase_alignment); NEXT_PASS (pass_ipa_tm); NEXT_PASS (pass_ipa_lower_emutls); @@ -161,6 +161,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_ipa_fn_summary); NEXT_PASS (pass_ipa_inline); NEXT_PASS (pass_ipa_pure_const); + NEXT_PASS (pass_ipa_free_fn_summary, false /* small_p */); NEXT_PASS (pass_ipa_reference); /* This pass needs to be scheduled after any IP code duplication. */ NEXT_PASS (pass_ipa_single_use); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e0e2c4a..f063f26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-12-20 Jakub Jelinek <jakub@redhat.com> + + PR ipa/83506 + * gcc.dg/pr83506.c: New test. + * gcc.dg/ipa/ctor-empty-1.c: Use -fdump-ipa-free-fnsummary1 instead + of -fdump-ipa-free-fnsummary and scan in free-fnsummary1 instead of + free-fnsummary dump. + 2017-12-20 Martin Sebor <msebor@redhat.com> PR testsuite/83483 @@ -4364,7 +4372,7 @@ * g++.dg/pr82725.C: Move to ... * g++.dg/cpp0x/pr82725.C: ... here. Add c++11 target directive. -2017-10-30 Steven G. Kargl <kargl@gcc.gnu.org> +2017-10-30 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/dtio_13.f90: Remove TODO comment and dg-error test. diff --git a/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c b/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c index 0807d49..264ca3f 100644 --- a/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c +++ b/gcc/testsuite/gcc.dg/ipa/ctor-empty-1.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -c -fdump-ipa-free-fnsummary" } */ +/* { dg-options "-O3 -c -fdump-ipa-free-fnsummary1" } */ static __attribute__((constructor)) void empty_constructor() { } -/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "free-fnsummary" } } */ +/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "free-fnsummary1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr83506.c b/gcc/testsuite/gcc.dg/pr83506.c new file mode 100644 index 0000000..b138c9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr83506.c @@ -0,0 +1,14 @@ +/* PR ipa/83506 */ +/* { dg-do compile { target pthread } } */ +/* { dg-options "-O1 -ftree-parallelize-loops=2 -fno-ipa-pure-const" } */ + +unsigned int +foo (unsigned int x, int y) +{ + while (y < 1) + { + x *= 3; + ++y; + } + return x; +} |