Commit 65f52ee9 by Richard Biener Committed by Richard Biener

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
parent 27b95a65
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.
* gimple-walk.c (walk_gimple_op): Initialize it.
(walk_gimple_asm): Set wi->is_lhs before each callback invocation.
......
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
......
/* { 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;
}
......@@ -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);
......
......@@ -4306,26 +4306,19 @@ init_scc_vn (void)
}
}
/* Restore SSA info that has been reset on value leaders. */
void
free_scc_vn (void)
scc_vn_restore_ssa_info (void)
{
size_t i;
delete constant_to_value_id;
constant_to_value_id = NULL;
BITMAP_FREE (constant_value_ids);
shared_lookup_phiargs.release ();
shared_lookup_references.release ();
XDELETEVEC (rpo_numbers);
for (i = 0; i < num_ssa_names; i++)
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)
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;
......@@ -4338,6 +4331,28 @@ free_scc_vn (void)
}
}
}
}
void
free_scc_vn (void)
{
size_t i;
delete constant_to_value_id;
constant_to_value_id = NULL;
BITMAP_FREE (constant_value_ids);
shared_lookup_phiargs.release ();
shared_lookup_references.release ();
XDELETEVEC (rpo_numbers);
for (i = 0; i < num_ssa_names; i++)
{
tree name = ssa_name (i);
if (name
&& 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 ();
......
......@@ -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,
......
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