vrp: remove redundant has_single_use tests

gcc/ChangeLog:

	* tree-vrp.c (register_edge_assert_for_2): Remove redundant
	has_single_use() tests.
	(register_edge_assert_for_1): Likewise.
	(find_assert_locations_1): Check the liveness bitmap instead of
	checking has_single_use().

From-SVN: r235352
This commit is contained in:
Patrick Palka 2016-04-21 21:58:08 +00:00
parent 5c71225085
commit 6e07f9aaf3
2 changed files with 18 additions and 19 deletions

View File

@ -1,3 +1,11 @@
2016-04-21 Patrick Palka <ppalka@gcc.gnu.org>
* tree-vrp.c (register_edge_assert_for_2): Remove redundant
has_single_use() tests.
(register_edge_assert_for_1): Likewise.
(find_assert_locations_1): Check the liveness bitmap instead of
checking has_single_use().
2016-04-21 Kirill Yukhin <kirill.yukhin@intel.com> 2016-04-21 Kirill Yukhin <kirill.yukhin@intel.com>
PR target/70728 PR target/70728

View File

@ -5145,8 +5145,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
/* Only register an ASSERT_EXPR if NAME was found in the sub-graph /* Only register an ASSERT_EXPR if NAME was found in the sub-graph
reachable from E. */ reachable from E. */
if (live_on_edge (e, name) if (live_on_edge (e, name))
&& !has_single_use (name))
register_new_assert_for (name, name, comp_code, val, NULL, e, bsi); register_new_assert_for (name, name, comp_code, val, NULL, e, bsi);
/* In the case of NAME <= CST and NAME being defined as /* In the case of NAME <= CST and NAME being defined as
@ -5188,8 +5187,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
&& (cst2 == NULL_TREE && (cst2 == NULL_TREE
|| TREE_CODE (cst2) == INTEGER_CST) || TREE_CODE (cst2) == INTEGER_CST)
&& INTEGRAL_TYPE_P (TREE_TYPE (name3)) && INTEGRAL_TYPE_P (TREE_TYPE (name3))
&& live_on_edge (e, name3) && live_on_edge (e, name3))
&& !has_single_use (name3))
{ {
tree tmp; tree tmp;
@ -5215,8 +5213,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
&& TREE_CODE (name2) == SSA_NAME && TREE_CODE (name2) == SSA_NAME
&& TREE_CODE (cst2) == INTEGER_CST && TREE_CODE (cst2) == INTEGER_CST
&& INTEGRAL_TYPE_P (TREE_TYPE (name2)) && INTEGRAL_TYPE_P (TREE_TYPE (name2))
&& live_on_edge (e, name2) && live_on_edge (e, name2))
&& !has_single_use (name2))
{ {
tree tmp; tree tmp;
@ -5319,8 +5316,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
tree op1 = gimple_assign_rhs2 (def_stmt); tree op1 = gimple_assign_rhs2 (def_stmt);
if (TREE_CODE (op0) == SSA_NAME if (TREE_CODE (op0) == SSA_NAME
&& TREE_CODE (op1) == INTEGER_CST && TREE_CODE (op1) == INTEGER_CST
&& live_on_edge (e, op0) && live_on_edge (e, op0))
&& !has_single_use (op0))
{ {
enum tree_code reverse_op = (rhs_code == PLUS_EXPR enum tree_code reverse_op = (rhs_code == PLUS_EXPR
? MINUS_EXPR : PLUS_EXPR); ? MINUS_EXPR : PLUS_EXPR);
@ -5346,8 +5342,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
&& (comp_code == LE_EXPR || comp_code == GT_EXPR && (comp_code == LE_EXPR || comp_code == GT_EXPR
|| !tree_int_cst_equal (val, || !tree_int_cst_equal (val,
TYPE_MIN_VALUE (TREE_TYPE (val)))) TYPE_MIN_VALUE (TREE_TYPE (val))))
&& live_on_edge (e, name2) && live_on_edge (e, name2))
&& !has_single_use (name2))
{ {
tree tmp, cst; tree tmp, cst;
enum tree_code new_comp_code = comp_code; enum tree_code new_comp_code = comp_code;
@ -5392,8 +5387,7 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
&& INTEGRAL_TYPE_P (TREE_TYPE (name2)) && INTEGRAL_TYPE_P (TREE_TYPE (name2))
&& IN_RANGE (tree_to_uhwi (cst2), 1, prec - 1) && IN_RANGE (tree_to_uhwi (cst2), 1, prec - 1)
&& prec == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (val))) && prec == GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (val)))
&& live_on_edge (e, name2) && live_on_edge (e, name2))
&& !has_single_use (name2))
{ {
mask = wi::mask (tree_to_uhwi (cst2), false, prec); mask = wi::mask (tree_to_uhwi (cst2), false, prec);
val2 = fold_binary (LSHIFT_EXPR, TREE_TYPE (val), val, cst2); val2 = fold_binary (LSHIFT_EXPR, TREE_TYPE (val), val, cst2);
@ -5498,12 +5492,10 @@ register_edge_assert_for_2 (tree name, edge e, gimple_stmt_iterator bsi,
|| !INTEGRAL_TYPE_P (TREE_TYPE (names[1])) || !INTEGRAL_TYPE_P (TREE_TYPE (names[1]))
|| (TYPE_PRECISION (TREE_TYPE (name2)) || (TYPE_PRECISION (TREE_TYPE (name2))
!= TYPE_PRECISION (TREE_TYPE (names[1]))) != TYPE_PRECISION (TREE_TYPE (names[1])))
|| !live_on_edge (e, names[1]) || !live_on_edge (e, names[1]))
|| has_single_use (names[1]))
names[1] = NULL_TREE; names[1] = NULL_TREE;
} }
if (live_on_edge (e, name2) if (live_on_edge (e, name2))
&& !has_single_use (name2))
names[0] = name2; names[0] = name2;
} }
} }
@ -5724,8 +5716,7 @@ register_edge_assert_for_1 (tree op, enum tree_code code,
/* We know that OP will have a zero or nonzero value. If OP is used /* We know that OP will have a zero or nonzero value. If OP is used
more than once go ahead and register an assert for OP. */ more than once go ahead and register an assert for OP. */
if (live_on_edge (e, op) if (live_on_edge (e, op))
&& !has_single_use (op))
{ {
val = build_int_cst (TREE_TYPE (op), 0); val = build_int_cst (TREE_TYPE (op), 0);
register_new_assert_for (op, op, code, val, NULL, e, bsi); register_new_assert_for (op, op, code, val, NULL, e, bsi);
@ -6158,7 +6149,7 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
/* Note we want to register the assert for the /* Note we want to register the assert for the
operand of the NOP_EXPR after SI, not after the operand of the NOP_EXPR after SI, not after the
conversion. */ conversion. */
if (! has_single_use (t)) if (bitmap_bit_p (live, SSA_NAME_VERSION (t)))
register_new_assert_for (t, t, comp_code, value, register_new_assert_for (t, t, comp_code, value,
bb, NULL, si); bb, NULL, si);
} }