Commit d822570f by Richard Biener Committed by Richard Biener

genmatch.c (capture_info::walk_c_expr): Ignore capture uses inside TREE_TYPE ().

2014-10-30  Richard Biener  <rguenther@suse.de>

	* genmatch.c (capture_info::walk_c_expr): Ignore capture
	uses inside TREE_TYPE ().
	* gimple-ssa-strength-reduction.c (stmt_cost): Use CASE_CONVERT.
	(find_candidates_dom_walker::before_dom_children): Likewise.
	(replace_mult_candidate): Use CONVERT_EXPR_CODE_P.
	(replace_profitable_candidates): Likewise.
	* tree-ssa-dom.c (initialize_hash_element): Canonicalize
	CONVERT_EXPR_CODE_P to CONVERT_EXPR.
	* convert.c (convert_to_integer): Use CASE_CONVERT.

From-SVN: r216939
parent 665c06ce
2014-10-30 Richard Biener <rguenther@suse.de> 2014-10-30 Richard Biener <rguenther@suse.de>
* genmatch.c (capture_info::walk_c_expr): Ignore capture
uses inside TREE_TYPE ().
* gimple-ssa-strength-reduction.c (stmt_cost): Use CASE_CONVERT.
(find_candidates_dom_walker::before_dom_children): Likewise.
(replace_mult_candidate): Use CONVERT_EXPR_CODE_P.
(replace_profitable_candidates): Likewise.
* tree-ssa-dom.c (initialize_hash_element): Canonicalize
CONVERT_EXPR_CODE_P to CONVERT_EXPR.
* convert.c (convert_to_integer): Use CASE_CONVERT.
2014-10-30 Richard Biener <rguenther@suse.de>
* match.pd: Implement more patterns that simplify to a single value. * match.pd: Implement more patterns that simplify to a single value.
* fold-const.c (fold_binary_loc): Remove them here. * fold-const.c (fold_binary_loc): Remove them here.
* tree-ssa-forwprop.c (simplify_bitwise_binary): Likewise. * tree-ssa-forwprop.c (simplify_bitwise_binary): Likewise.
...@@ -831,7 +831,7 @@ convert_to_integer (tree type, tree expr) ...@@ -831,7 +831,7 @@ convert_to_integer (tree type, tree expr)
TREE_OPERAND (expr, 0)))); TREE_OPERAND (expr, 0))));
} }
case NOP_EXPR: CASE_CONVERT:
/* Don't introduce a /* Don't introduce a
"can't convert between vector values of different size" error. */ "can't convert between vector values of different size" error. */
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == VECTOR_TYPE if (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == VECTOR_TYPE
......
...@@ -2004,21 +2004,34 @@ capture_info::walk_result (operand *o, bool conditional_p) ...@@ -2004,21 +2004,34 @@ capture_info::walk_result (operand *o, bool conditional_p)
void void
capture_info::walk_c_expr (c_expr *e) capture_info::walk_c_expr (c_expr *e)
{ {
/* Give up for C exprs mentioning captures. */ /* Give up for C exprs mentioning captures not inside TREE_TYPE (). */
unsigned p_depth = 0;
for (unsigned i = 0; i < e->code.length (); ++i) for (unsigned i = 0; i < e->code.length (); ++i)
if (e->code[i].type == CPP_ATSIGN {
&& (e->code[i+1].type == CPP_NUMBER const cpp_token *t = &e->code[i];
|| e->code[i+1].type == CPP_NAME) const cpp_token *n = i < e->code.length () - 1 ? &e->code[i+1] : NULL;
&& !(e->code[i+1].flags & PREV_WHITE)) if (t->type == CPP_NAME
{ && strcmp ((const char *)CPP_HASHNODE
const cpp_token *n = &e->code[i+1]; (t->val.node.node)->ident.str, "TREE_TYPE") == 0
const char *id; && n->type == CPP_OPEN_PAREN)
if (n->type == CPP_NUMBER) p_depth++;
id = (const char *)n->val.str.text; else if (t->type == CPP_CLOSE_PAREN
else && p_depth > 0)
id = (const char *)CPP_HASHNODE (n->val.node.node)->ident.str; p_depth--;
info[(*e->capture_ids)[id]].force_no_side_effects_p = true; else if (p_depth == 0
} && t->type == CPP_ATSIGN
&& (n->type == CPP_NUMBER
|| n->type == CPP_NAME)
&& !(n->flags & PREV_WHITE))
{
const char *id;
if (n->type == CPP_NUMBER)
id = (const char *)n->val.str.text;
else
id = (const char *)CPP_HASHNODE (n->val.node.node)->ident.str;
info[(*e->capture_ids)[id]].force_no_side_effects_p = true;
}
}
} }
......
...@@ -705,7 +705,7 @@ stmt_cost (gimple gs, bool speed) ...@@ -705,7 +705,7 @@ stmt_cost (gimple gs, bool speed)
case NEGATE_EXPR: case NEGATE_EXPR:
return neg_cost (speed, lhs_mode); return neg_cost (speed, lhs_mode);
case NOP_EXPR: CASE_CONVERT:
return convert_cost (lhs_mode, TYPE_MODE (TREE_TYPE (rhs1)), speed); return convert_cost (lhs_mode, TYPE_MODE (TREE_TYPE (rhs1)), speed);
/* Note that we don't assign costs to copies that in most cases /* Note that we don't assign costs to copies that in most cases
...@@ -1715,7 +1715,7 @@ find_candidates_dom_walker::before_dom_children (basic_block bb) ...@@ -1715,7 +1715,7 @@ find_candidates_dom_walker::before_dom_children (basic_block bb)
rhs2 = gimple_assign_rhs2 (gs); rhs2 = gimple_assign_rhs2 (gs);
/* Fall-through. */ /* Fall-through. */
case NOP_EXPR: CASE_CONVERT:
case MODIFY_EXPR: case MODIFY_EXPR:
case NEGATE_EXPR: case NEGATE_EXPR:
rhs1 = gimple_assign_rhs1 (gs); rhs1 = gimple_assign_rhs1 (gs);
...@@ -1743,7 +1743,7 @@ find_candidates_dom_walker::before_dom_children (basic_block bb) ...@@ -1743,7 +1743,7 @@ find_candidates_dom_walker::before_dom_children (basic_block bb)
slsr_process_neg (gs, rhs1, speed); slsr_process_neg (gs, rhs1, speed);
break; break;
case NOP_EXPR: CASE_CONVERT:
slsr_process_cast (gs, rhs1, speed); slsr_process_cast (gs, rhs1, speed);
break; break;
...@@ -2033,7 +2033,7 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump) ...@@ -2033,7 +2033,7 @@ replace_mult_candidate (slsr_cand_t c, tree basis_name, widest_int bump)
/* It is not useful to replace casts, copies, or adds of /* It is not useful to replace casts, copies, or adds of
an SSA name and a constant. */ an SSA name and a constant. */
&& cand_code != MODIFY_EXPR && cand_code != MODIFY_EXPR
&& cand_code != NOP_EXPR && !CONVERT_EXPR_CODE_P (cand_code)
&& cand_code != PLUS_EXPR && cand_code != PLUS_EXPR
&& cand_code != POINTER_PLUS_EXPR && cand_code != POINTER_PLUS_EXPR
&& cand_code != MINUS_EXPR) && cand_code != MINUS_EXPR)
...@@ -3472,7 +3472,7 @@ replace_profitable_candidates (slsr_cand_t c) ...@@ -3472,7 +3472,7 @@ replace_profitable_candidates (slsr_cand_t c)
if (i >= 0 if (i >= 0
&& profitable_increment_p (i) && profitable_increment_p (i)
&& orig_code != MODIFY_EXPR && orig_code != MODIFY_EXPR
&& orig_code != NOP_EXPR) && !CONVERT_EXPR_CODE_P (orig_code))
{ {
if (phi_dependent_cand_p (c)) if (phi_dependent_cand_p (c))
{ {
......
...@@ -305,6 +305,8 @@ initialize_hash_element (gimple stmt, tree lhs, ...@@ -305,6 +305,8 @@ initialize_hash_element (gimple stmt, tree lhs,
case GIMPLE_UNARY_RHS: case GIMPLE_UNARY_RHS:
expr->kind = EXPR_UNARY; expr->kind = EXPR_UNARY;
expr->type = TREE_TYPE (gimple_assign_lhs (stmt)); expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
if (CONVERT_EXPR_CODE_P (subcode))
subcode = CONVERT_EXPR;
expr->ops.unary.op = subcode; expr->ops.unary.op = subcode;
expr->ops.unary.opnd = gimple_assign_rhs1 (stmt); expr->ops.unary.opnd = gimple_assign_rhs1 (stmt);
break; break;
......
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