Commit 442db276 by Jakub Jelinek

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
parent 76a2bcdc
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.
......@@ -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
......
......@@ -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;
}
......
......@@ -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);
......
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.
......
/* { 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" } } */
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment