aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-10-09 08:12:18 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-10-09 08:12:18 +0000
commitc0f6274015fa8bc650f9ded206c1a0f602b1254d (patch)
treea54ff8c6d5c8ec6eb2b4f543dcefbd2c343e3444 /gcc/tree-ssa-sccvn.c
parent2795c84a46d65e5a4bbb548438da597c5863cad9 (diff)
downloadgcc-c0f6274015fa8bc650f9ded206c1a0f602b1254d.zip
gcc-c0f6274015fa8bc650f9ded206c1a0f602b1254d.tar.gz
gcc-c0f6274015fa8bc650f9ded206c1a0f602b1254d.tar.bz2
re PR middle-end/67891 (FAIL: gcc.dg/pr43300.c (internal compiler error) on alpha-linux-gnu)
2015-10-09 Richard Biener <rguenther@suse.de> PR tree-optimization/67891 * gimple-match.h (gimple_simplified_result_is_gimple_val): New helper. (gimple_resimplify1): Declare. (gimple_resimplify2): Likewise. (gimple_resimplify3): Likewise. * gimple-match-head.c (gimple_resimplify1): Export. (gimple_resimplify2): Likewise. (gimple_resimplify3): Likewise. (maybe_push_res_to_seq): Use gimple_simplified_result_is_gimple_val. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Likewise. * tree-ssa-sccvn.c (visit_reference_op_load): Use gimple_resimplify1 to avoid creating stmts without VN info. * gcc.dg/tree-ssa/pr67891.c: New testcase. From-SVN: r228635
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 0432a5db..f2eb213 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -3043,38 +3043,41 @@ visit_reference_op_load (tree lhs, tree op, gimple *stmt)
of VIEW_CONVERT_EXPR <TREE_TYPE (result)> (result).
So first simplify and lookup this expression to see if it
is already available. */
- gimple_seq stmts = NULL;
mprts_hook = vn_lookup_simplify_result;
- tree val = gimple_simplify (VIEW_CONVERT_EXPR, TREE_TYPE (op),
- result, &stmts, vn_valueize);
+ code_helper rcode = VIEW_CONVERT_EXPR;
+ tree ops[3] = { result };
+ bool res = gimple_resimplify1 (NULL, &rcode, TREE_TYPE (op), ops,
+ vn_valueize);
mprts_hook = NULL;
- if (!val)
+ gimple *new_stmt = NULL;
+ if (res
+ && gimple_simplified_result_is_gimple_val (rcode, ops))
+ /* The expression is already available. */
+ result = ops[0];
+ else
{
- val = vn_nary_op_lookup_pieces (1, VIEW_CONVERT_EXPR,
- TREE_TYPE (op), &result, NULL);
+ tree val = vn_lookup_simplify_result (rcode, TREE_TYPE (op), ops);
if (!val)
{
- val = make_ssa_name (TREE_TYPE (op));
- gimple *new_stmt = gimple_build_assign (val, VIEW_CONVERT_EXPR,
- build1 (VIEW_CONVERT_EXPR,
- TREE_TYPE (op),
- result));
- gimple_seq_add_stmt_without_update (&stmts, new_stmt);
+ gimple_seq stmts = NULL;
+ result = maybe_push_res_to_seq (rcode, TREE_TYPE (op), ops,
+ &stmts);
+ gcc_assert (result && gimple_seq_singleton_p (stmts));
+ new_stmt = gimple_seq_first_stmt (stmts);
}
+ else
+ /* The expression is already available. */
+ result = val;
}
- if (gimple_seq_empty_p (stmts))
- /* The expression is already available. */
- result = val;
- else
+ if (new_stmt)
{
- gcc_assert (gimple_seq_singleton_p (stmts));
/* The expression is not yet available, value-number lhs to
the new SSA_NAME we created. */
- result = val;
/* Initialize value-number information properly. */
VN_INFO_GET (result)->valnum = result;
VN_INFO (result)->value_id = get_next_value_id ();
- VN_INFO (result)->expr = stmts;
+ gimple_seq_add_stmt_without_update (&VN_INFO (result)->expr,
+ new_stmt);
VN_INFO (result)->needs_insertion = true;
/* As all "inserted" statements are singleton SCCs, insert
to the valid table. This is strictly needed to
@@ -3086,18 +3089,17 @@ visit_reference_op_load (tree lhs, tree op, gimple *stmt)
if (current_info == optimistic_info)
{
current_info = valid_info;
- vn_nary_op_insert_stmt (gimple_seq_first_stmt (stmts), result);
+ vn_nary_op_insert_stmt (new_stmt, result);
current_info = optimistic_info;
}
else
- vn_nary_op_insert_stmt (gimple_seq_first_stmt (stmts), result);
+ vn_nary_op_insert_stmt (new_stmt, result);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Inserting name ");
print_generic_expr (dump_file, result, 0);
fprintf (dump_file, " for expression ");
- print_gimple_expr (dump_file, gimple_seq_first_stmt (stmts),
- 0, TDF_SLIM);
+ print_gimple_expr (dump_file, new_stmt, 0, TDF_SLIM);
fprintf (dump_file, "\n");
}
}