Commit c47bee97 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/92401 (ICE in fold_ternary_loc, at fold-const.c:11698)

	PR tree-optimization/92401
	* gimple-match-head.c (gimple_resimplify1): Call const_unop only
	if res_op->code is an expression with code length 1.
	* gimple-match-head.c (gimple_resimplify2): Call const_binop only
	if res_op->code is an expression with code length 2.
	* gimple-match-head.c (gimple_resimplify3): Call fold_ternary only
	if res_op->code is an expression with code length 3.

	* g++.dg/opt/pr92401.C: New test.

From-SVN: r278004
parent b03932cb
2019-11-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92401
* gimple-match-head.c (gimple_resimplify1): Call const_unop only
if res_op->code is an expression with code length 1.
* gimple-match-head.c (gimple_resimplify2): Call const_binop only
if res_op->code is an expression with code length 2.
* gimple-match-head.c (gimple_resimplify3): Call fold_ternary only
if res_op->code is an expression with code length 3.
2019-11-09 Iain Sandoe <iain@sandoe.co.uk> 2019-11-09 Iain Sandoe <iain@sandoe.co.uk>
* config/darwin.c (machopic_mcount_stub_name): Validate the * config/darwin.c (machopic_mcount_stub_name): Validate the
...@@ -191,7 +191,12 @@ gimple_resimplify1 (gimple_seq *seq, gimple_match_op *res_op, ...@@ -191,7 +191,12 @@ gimple_resimplify1 (gimple_seq *seq, gimple_match_op *res_op,
{ {
tree tem = NULL_TREE; tree tem = NULL_TREE;
if (res_op->code.is_tree_code ()) if (res_op->code.is_tree_code ())
tem = const_unop (res_op->code, res_op->type, res_op->ops[0]); {
tree_code code = res_op->code;
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
&& TREE_CODE_LENGTH (code) == 1)
tem = const_unop (res_op->code, res_op->type, res_op->ops[0]);
}
else else
tem = fold_const_call (combined_fn (res_op->code), res_op->type, tem = fold_const_call (combined_fn (res_op->code), res_op->type,
res_op->ops[0]); res_op->ops[0]);
...@@ -252,8 +257,13 @@ gimple_resimplify2 (gimple_seq *seq, gimple_match_op *res_op, ...@@ -252,8 +257,13 @@ gimple_resimplify2 (gimple_seq *seq, gimple_match_op *res_op,
{ {
tree tem = NULL_TREE; tree tem = NULL_TREE;
if (res_op->code.is_tree_code ()) if (res_op->code.is_tree_code ())
tem = const_binop (res_op->code, res_op->type, {
res_op->ops[0], res_op->ops[1]); tree_code code = res_op->code;
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
&& TREE_CODE_LENGTH (code) == 2)
tem = const_binop (res_op->code, res_op->type,
res_op->ops[0], res_op->ops[1]);
}
else else
tem = fold_const_call (combined_fn (res_op->code), res_op->type, tem = fold_const_call (combined_fn (res_op->code), res_op->type,
res_op->ops[0], res_op->ops[1]); res_op->ops[0], res_op->ops[1]);
...@@ -325,9 +335,14 @@ gimple_resimplify3 (gimple_seq *seq, gimple_match_op *res_op, ...@@ -325,9 +335,14 @@ gimple_resimplify3 (gimple_seq *seq, gimple_match_op *res_op,
{ {
tree tem = NULL_TREE; tree tem = NULL_TREE;
if (res_op->code.is_tree_code ()) if (res_op->code.is_tree_code ())
tem = fold_ternary/*_to_constant*/ (res_op->code, res_op->type, {
res_op->ops[0], res_op->ops[1], tree_code code = res_op->code;
res_op->ops[2]); if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
&& TREE_CODE_LENGTH (code) == 3)
tem = fold_ternary/*_to_constant*/ (res_op->code, res_op->type,
res_op->ops[0], res_op->ops[1],
res_op->ops[2]);
}
else else
tem = fold_const_call (combined_fn (res_op->code), res_op->type, tem = fold_const_call (combined_fn (res_op->code), res_op->type,
res_op->ops[0], res_op->ops[1], res_op->ops[2]); res_op->ops[0], res_op->ops[1], res_op->ops[2]);
......
2019-11-09 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/92401
* g++.dg/opt/pr92401.C: New test.
2019-11-09 Thomas Koenig <tkoenig@gcc.gnu.org> 2019-11-09 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/92321 PR fortran/92321
......
// PR tree-optimization/92401
// { dg-do compile { target c++11 } }
// { dg-options "-O2" }
typedef float V __attribute__ ((__vector_size__ (4 * sizeof (float))));
V v;
void
foo ()
{
int i;
for (i = 0; i < 11; ++i)
v = V { 0.0f, 0.0f, (float) i, 0.0f };
}
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