re PR tree-optimization/70724 (Miscompiles python3 with FDO)

2016-04-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70724
	* tree-ssa-sccvn.c (scc_vn_restore_ssa_info): Split SSA info
	restoring out from ...
	(free_scc_vn): ... here.
	* tree-ssa-sccvn.h (scc_vn_restore_ssa_info): Declare.
	* tres-ssa-pre.c (pass_pre::execute): Restore SSA info before
	tail merging.
	(pass_fre::execute): Restore SSA info.

	* gcc.dg/torture/pr70724.c: New testcase.

From-SVN: r235203
This commit is contained in:
Richard Biener 2016-04-19 13:22:19 +00:00 committed by Richard Biener
parent 27b95a6541
commit 65f52ee9b9
6 changed files with 90 additions and 15 deletions

View File

@ -1,3 +1,14 @@
2016-04-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/70724
* tree-ssa-sccvn.c (scc_vn_restore_ssa_info): Split SSA info
restoring out from ...
(free_scc_vn): ... here.
* tree-ssa-sccvn.h (scc_vn_restore_ssa_info): Declare.
* tres-ssa-pre.c (pass_pre::execute): Restore SSA info before
tail merging.
(pass_fre::execute): Restore SSA info.
2016-04-19 Richard Biener <rguenther@suse.de>
* gimple-walk.h (struct walk_stmt_info): Add stmt member.

View File

@ -1,3 +1,8 @@
2016-04-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/70724
* gcc.dg/torture/pr70724.c: New testcase.
2016-04-18 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/70689

View File

@ -0,0 +1,39 @@
/* { dg-do run } */
/* { dg-additional-options "-ftracer" } */
extern void abort (void);
typedef long int _PyTime_t;
typedef enum { _PyTime_ROUND_FLOOR = 0, _PyTime_ROUND_CEILING = 1 }
_PyTime_round_t;
static _PyTime_t
_PyTime_Divide(const _PyTime_t t, const _PyTime_t k,
const _PyTime_round_t round)
{
if (round == _PyTime_ROUND_CEILING) {
if (t >= 0)
return (t + k - 1) / k;
else
return t / k;
}
else {
if (t >= 0)
return t / k;
else
return (t - (k - 1)) / k;
}
}
_PyTime_t __attribute__((noinline,noclone))
_PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round)
{
return _PyTime_Divide(t, 1000, round);
}
int main()
{
if (_PyTime_AsMicroseconds (10000, _PyTime_ROUND_FLOOR) != 10)
abort ();
return 0;
}

View File

@ -4804,6 +4804,9 @@ pass_pre::execute (function *fun)
todo |= fini_eliminate ();
loop_optimizer_finalize ();
/* Restore SSA info before tail-merging as that resets it as well. */
scc_vn_restore_ssa_info ();
/* TODO: tail_merge_optimize may merge all predecessors of a block, in which
case we can merge the block with the remaining predecessor of the block.
It should either:
@ -4877,6 +4880,7 @@ pass_fre::execute (function *fun)
todo |= fini_eliminate ();
scc_vn_restore_ssa_info ();
free_scc_vn ();
statistics_counter_event (fun, "Insertions", pre_stats.insertions);

View File

@ -4306,6 +4306,33 @@ init_scc_vn (void)
}
}
/* Restore SSA info that has been reset on value leaders. */
void
scc_vn_restore_ssa_info (void)
{
for (unsigned i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
if (name
&& has_VN_INFO (name))
{
if (VN_INFO (name)->needs_insertion)
;
else if (POINTER_TYPE_P (TREE_TYPE (name))
&& VN_INFO (name)->info.ptr_info)
SSA_NAME_PTR_INFO (name) = VN_INFO (name)->info.ptr_info;
else if (INTEGRAL_TYPE_P (TREE_TYPE (name))
&& VN_INFO (name)->info.range_info)
{
SSA_NAME_RANGE_INFO (name) = VN_INFO (name)->info.range_info;
SSA_NAME_ANTI_RANGE_P (name)
= VN_INFO (name)->range_info_anti_range_p;
}
}
}
}
void
free_scc_vn (void)
{
@ -4322,21 +4349,9 @@ free_scc_vn (void)
{
tree name = ssa_name (i);
if (name
&& has_VN_INFO (name))
{
if (VN_INFO (name)->needs_insertion)
release_ssa_name (name);
else if (POINTER_TYPE_P (TREE_TYPE (name))
&& VN_INFO (name)->info.ptr_info)
SSA_NAME_PTR_INFO (name) = VN_INFO (name)->info.ptr_info;
else if (INTEGRAL_TYPE_P (TREE_TYPE (name))
&& VN_INFO (name)->info.range_info)
{
SSA_NAME_RANGE_INFO (name) = VN_INFO (name)->info.range_info;
SSA_NAME_ANTI_RANGE_P (name)
= VN_INFO (name)->range_info_anti_range_p;
}
}
&& has_VN_INFO (name)
&& VN_INFO (name)->needs_insertion)
release_ssa_name (name);
}
obstack_free (&vn_ssa_aux_obstack, NULL);
vn_ssa_aux_table.release ();

View File

@ -204,6 +204,7 @@ extern vn_ssa_aux_t VN_INFO_GET (tree);
tree vn_get_expr_for (tree);
bool run_scc_vn (vn_lookup_kind);
void free_scc_vn (void);
void scc_vn_restore_ssa_info (void);
tree vn_nary_op_lookup (tree, vn_nary_op_t *);
tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *);
tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code,