diff options
author | Martin Jambor <mjambor@suse.cz> | 2013-06-24 14:51:43 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2013-06-24 14:51:43 +0200 |
commit | 5fe8e75785444ce465efa5692553ef7cac07a3bd (patch) | |
tree | 56275519efe2b184d885e764d4ba6ab580d4b164 | |
parent | 44a60244592da0196f7c1d8cfe56bc95d7cdae0e (diff) | |
download | gcc-5fe8e75785444ce465efa5692553ef7cac07a3bd.zip gcc-5fe8e75785444ce465efa5692553ef7cac07a3bd.tar.gz gcc-5fe8e75785444ce465efa5692553ef7cac07a3bd.tar.bz2 |
re PR tree-optimization/57358 (segmentation fault with attribute(optimize(O0)))
2013-06-24 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/57358
* ipa-prop.c (ipa_func_spec_opts_forbid_analysis_p): New function.
(ipa_compute_jump_functions_for_edge): Bail out if it returns true.
(ipa_analyze_params_uses): Generate pessimistic info when true.
testsuite
* gcc.dg/ipa/pr57358.c: New test.
From-SVN: r200369
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/pr57358.c | 9 |
4 files changed, 50 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e55152..8f45983 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2013-06-24 Martin Jambor <mjambor@suse.cz> + PR tree-optimization/57358 + * ipa-prop.c (ipa_func_spec_opts_forbid_analysis_p): New function. + (ipa_compute_jump_functions_for_edge): Bail out if it returns true. + (ipa_analyze_params_uses): Generate pessimistic info when true. + +2013-06-24 Martin Jambor <mjambor@suse.cz> + PR tree-optimization/57539 * cgraphclones.c (cgraph_clone_node): Add parameter new_inlined_to, set global.inlined_to of the new node to it. All callers changed. diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index e5e7dd0..ae6825b 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -78,6 +78,21 @@ struct ipa_cst_ref_desc static alloc_pool ipa_refdesc_pool; +/* Return true if DECL_FUNCTION_SPECIFIC_OPTIMIZATION of the decl associated + with NODE should prevent us from analyzing it for the purposes of IPA-CP. */ + +static bool +ipa_func_spec_opts_forbid_analysis_p (struct cgraph_node *node) +{ + tree fs_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node->symbol.decl); + struct cl_optimization *os; + + if (!fs_opts) + return false; + os = TREE_OPTIMIZATION (fs_opts); + return !os->x_optimize || !os->x_flag_ipa_cp; +} + /* Return index of the formal whose tree is PTREE in function which corresponds to INFO. */ @@ -1446,6 +1461,9 @@ ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_ainfo, return; vec_safe_grow_cleared (args->jump_functions, arg_num); + if (ipa_func_spec_opts_forbid_analysis_p (cs->caller)) + return; + for (n = 0; n < arg_num; n++) { struct ipa_jump_func *jfunc = ipa_get_ith_jump_func (args, n); @@ -1936,6 +1954,17 @@ ipa_analyze_params_uses (struct cgraph_node *node, if (ipa_get_param_count (info) == 0 || info->uses_analysis_done) return; + info->uses_analysis_done = 1; + if (ipa_func_spec_opts_forbid_analysis_p (node)) + { + for (i = 0; i < ipa_get_param_count (info); i++) + { + ipa_set_param_used (info, i, true); + ipa_set_controlled_uses (info, i, IPA_UNDESCRIBED_USE); + } + return; + } + for (i = 0; i < ipa_get_param_count (info); i++) { tree parm = ipa_get_param (info, i); @@ -1992,8 +2021,6 @@ ipa_analyze_params_uses (struct cgraph_node *node, visit_ref_for_mod_analysis, visit_ref_for_mod_analysis); } - - info->uses_analysis_done = 1; } /* Free stuff in PARMS_AINFO, assume there are PARAM_COUNT parameters. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 867e70d..9940868 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-06-24 Martin Jambor <mjambor@suse.cz> + + PR tree-optimization/57358 + * gcc.dg/ipa/pr57358.c: New test. + 2013-06-24 Richard Biener <rguenther@suse.de> PR testsuite/57686 diff --git a/gcc/testsuite/gcc.dg/ipa/pr57358.c b/gcc/testsuite/gcc.dg/ipa/pr57358.c new file mode 100644 index 0000000..c83396f --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr57358.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct t { void (*func)(void*); }; +void test_func(struct t* a) __attribute__((optimize("O0"))); +void test_func(struct t* a) +{ + a->func(0); +} |