Commit c265dfbf by Richard Biener Committed by Richard Biener

re PR target/92280 (gcc.target/i386/pr83008.c FAILs)

2019-11-05  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92280
	* match.pd (BIT_FIELD_REF of CTOR): Unless the original CTOR
	had a single use do not create a new CTOR.
	* tree-ssa-forwprop.c (simplify_bitfield_ref): Do not re-fold
	BIT_FIELD_REF of a CTOR via GENERIC.

From-SVN: r277832
parent d9adca6e
2019-11-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/92280
* match.pd (BIT_FIELD_REF of CTOR): Unless the original CTOR
had a single use do not create a new CTOR.
* tree-ssa-forwprop.c (simplify_bitfield_ref): Do not re-fold
BIT_FIELD_REF of a CTOR via GENERIC.
2019-11-05 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.c (s390_vector_alignment): Check if the value
......@@ -5565,15 +5565,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (elt < CONSTRUCTOR_NELTS (ctor))
(view_convert { CONSTRUCTOR_ELT (ctor, elt)->value; })
{ build_zero_cst (type); })
{
vec<constructor_elt, va_gc> *vals;
vec_alloc (vals, count);
for (unsigned i = 0;
i < count && elt + i < CONSTRUCTOR_NELTS (ctor); ++i)
CONSTRUCTOR_APPEND_ELT (vals, NULL_TREE,
CONSTRUCTOR_ELT (ctor, elt + i)->value);
build_constructor (type, vals);
})))
/* We don't want to emit new CTORs unless the old one goes away.
??? Eventually allow this if the CTOR ends up constant or
uniform. */
(if (single_use (@0))
{
vec<constructor_elt, va_gc> *vals;
vec_alloc (vals, count);
for (unsigned i = 0;
i < count && elt + i < CONSTRUCTOR_NELTS (ctor); ++i)
CONSTRUCTOR_APPEND_ELT (vals, NULL_TREE,
CONSTRUCTOR_ELT (ctor, elt + i)->value);
build_constructor (type, vals);
}))))
/* The bitfield references a single constructor element. */
(if (k.is_constant (&const_k)
&& idx + n <= (idx / const_k + 1) * const_k)
......
......@@ -1786,7 +1786,7 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi)
{
gimple *stmt = gsi_stmt (*gsi);
gimple *def_stmt;
tree op, op0, op1, op2;
tree op, op0, op1;
tree elem_type;
unsigned idx, size;
enum tree_code code;
......@@ -1804,20 +1804,7 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi)
return false;
op1 = TREE_OPERAND (op, 1);
op2 = TREE_OPERAND (op, 2);
code = gimple_assign_rhs_code (def_stmt);
if (code == CONSTRUCTOR)
{
tree tem = fold_ternary (BIT_FIELD_REF, TREE_TYPE (op),
gimple_assign_rhs1 (def_stmt), op1, op2);
if (!tem || !valid_gimple_rhs_p (tem))
return false;
gimple_assign_set_rhs_from_tree (gsi, tem);
update_stmt (gsi_stmt (*gsi));
return true;
}
elem_type = TREE_TYPE (TREE_TYPE (op0));
if (TREE_TYPE (op) != elem_type)
return false;
......
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