2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-03-28 21:31:32 +08:00

re PR tree-optimization/65917 (XFAIL: gcc.dg/tree-ssa/20030922-2.c scan-tree-dump-times dom1 "if " 2)

PR tree-optimization/65917
	* tree-ssa-dom.c (record_temporary_equivalences): Record both
	equivalences from if (x == y) style conditionals.
	(loop_depth_of_name): Remove.
	(record_equality): Remove loop depth check.
	* tree-ssa-scopedtables.h (const_and_copies): Refine comments.
	(const_and_copies::record_const_or_copy_raw): New member function.
	* tree-ssa-scopedtables.c
	(const_and_copies::record_const_or_copy_raw): New, factored out of
	(const_and_copies::record_const_or_copy): Call new member function.

        PR tree-optimization/65917
	* gcc.dg/tree-ssa/20030922-2.c: No longer xfailed.

From-SVN: r233207
This commit is contained in:
Jeff Law 2016-02-08 01:17:32 -07:00 committed by Jeff Law
parent 0992653daf
commit 0b604d2dfc
6 changed files with 68 additions and 55 deletions

@ -1,3 +1,17 @@
2016-02-08 Jeff Law <law@redhat.com>
PR tree-optimization/65917
* tree-ssa-dom.c (record_temporary_equivalences): Record both
equivalences from if (x == y) style conditionals.
(loop_depth_of_name): Remove.
(record_equality): Remove loop depth check.
* tree-ssa-scopedtables.h (const_and_copies): Refine comments.
(const_and_copies::record_const_or_copy_raw): New member function.
* tree-ssa-scopedtables.c
(const_and_copies::record_const_or_copy_raw): New, factored out of
(const_and_copies::record_const_or_copy): Call new member function.
2016-02-05 Jeff Law <law@redhat.com>
PR tree-optimization/68541

@ -1,3 +1,8 @@
2016-02-08 Jeff Law <law@redhat.com>
PR tree-optimization/65917
* gcc.dg/tree-ssa/20030922-2.c: No longer xfailed.
2016-02-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/50555

@ -20,8 +20,4 @@ rgn_rank (rtx insn1, rtx insn2)
}
/* There should be two IF conditionals. */
/* This now fails as it requires a very specific decision of DOM which
SSA name to record as a copy of the other when DOM derives copies
from temporary equivalences. The heuristics there no longer do
the correct thing. VRP still optimizes this testcase. */
/* { dg-final { scan-tree-dump-times "if " 2 "dom2" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "if " 2 "dom2" } } */

@ -917,6 +917,15 @@ record_temporary_equivalences (edge e,
tree rhs = edge_info->rhs;
record_equality (lhs, rhs, const_and_copies);
/* We already recorded that LHS = RHS, with canonicalization,
value chain following, etc.
We also want to return RHS = LHS, but without any canonicalization
or value chain following. */
if (TREE_CODE (rhs) == SSA_NAME)
const_and_copies->record_const_or_copy_raw (rhs, lhs,
SSA_NAME_VALUE (rhs));
/* If LHS is an SSA_NAME and RHS is a constant integer and LHS was
set via a widening type conversion, then we may be able to record
additional equivalences. */
@ -1161,33 +1170,6 @@ record_cond (cond_equivalence *p,
delete element;
}
/* Return the loop depth of the basic block of the defining statement of X.
This number should not be treated as absolutely correct because the loop
information may not be completely up-to-date when dom runs. However, it
will be relatively correct, and as more passes are taught to keep loop info
up to date, the result will become more and more accurate. */
static int
loop_depth_of_name (tree x)
{
gimple *defstmt;
basic_block defbb;
/* If it's not an SSA_NAME, we have no clue where the definition is. */
if (TREE_CODE (x) != SSA_NAME)
return 0;
/* Otherwise return the loop depth of the defining statement's bb.
Note that there may not actually be a bb for this statement, if the
ssa_name is live on entry. */
defstmt = SSA_NAME_DEF_STMT (x);
defbb = gimple_bb (defstmt);
if (!defbb)
return 0;
return bb_loop_depth (defbb);
}
/* Similarly, but assume that X and Y are the two operands of an EQ_EXPR.
This constrains the cases in which we may treat this as assignment. */
@ -1224,10 +1206,7 @@ record_equality (tree x, tree y, class const_and_copies *const_and_copies)
long as we canonicalize on one value. */
if (is_gimple_min_invariant (y))
;
else if (is_gimple_min_invariant (x)
/* ??? When threading over backedges the following is important
for correctness. See PR61757. */
|| (loop_depth_of_name (x) < loop_depth_of_name (y)))
else if (is_gimple_min_invariant (x))
prev_x = x, x = y, y = prev_x, prev_x = prev_y;
else if (prev_x && is_gimple_min_invariant (prev_x))
x = y, y = prev_x, prev_x = prev_y;

@ -700,26 +700,13 @@ const_and_copies::pop_to_marker (void)
}
}
/* Record that X has the value Y. */
/* Record that X has the value Y and that X's previous value is PREV_X.
This variant does not follow the value chain for Y. */
void
const_and_copies::record_const_or_copy (tree x, tree y)
const_and_copies::record_const_or_copy_raw (tree x, tree y, tree prev_x)
{
record_const_or_copy (x, y, SSA_NAME_VALUE (x));
}
/* Record that X has the value Y and that X's previous value is PREV_X. */
void
const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x)
{
/* Y may be NULL if we are invalidating entries in the table. */
if (y && TREE_CODE (y) == SSA_NAME)
{
tree tmp = SSA_NAME_VALUE (y);
y = tmp ? tmp : y;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "0>>> COPY ");
@ -735,6 +722,31 @@ const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x)
m_stack.quick_push (x);
}
/* Record that X has the value Y. */
void
const_and_copies::record_const_or_copy (tree x, tree y)
{
record_const_or_copy (x, y, SSA_NAME_VALUE (x));
}
/* Record that X has the value Y and that X's previous value is PREV_X.
This variant follow's Y value chain. */
void
const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x)
{
/* Y may be NULL if we are invalidating entries in the table. */
if (y && TREE_CODE (y) == SSA_NAME)
{
tree tmp = SSA_NAME_VALUE (y);
y = tmp ? tmp : y;
}
record_const_or_copy_raw (x, y, prev_x);
}
bool
expr_elt_hasher::equal (const value_type &p1, const compare_type &p2)
{

@ -161,11 +161,18 @@ class const_and_copies
was pushed. */
void pop_to_marker (void);
/* Record a single const/copy pair that can be unwound. */
/* Record a single const/copy pair that can be unwound. This version
may follow the value chain for the RHS. */
void record_const_or_copy (tree, tree);
/* Record a single const/copy pair that can be unwound. This version
does not follow the value chain for the RHS. */
void record_const_or_copy_raw (tree, tree, tree);
/* Special entry point when we want to provide an explicit previous
value for the first argument. Try to get rid of this in the future. */
value for the first argument. Try to get rid of this in the future.
This version may also follow the value chain for the RHS. */
void record_const_or_copy (tree, tree, tree);
private: