[PATCH] Fix PR54825
Richard Guenther
rguenther@suse.de
Mon Oct 8 11:57:00 GMT 2012
This fixes PR54825, properly FRE/PRE vector BIT_FIELD_REFs.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2012-10-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/54825
* tree-ssa-sccvn.c (vn_nary_length_from_stmt): Handle BIT_FIELD_REF.
(init_vn_nary_op_from_stmt): Likewise.
* tree-ssa-pre.c (compute_avail): Use vn_nary_op_lookup_stmt.
* tree-ssa-sccvn.h (sizeof_vn_nary_op): Avoid overflow.
Index: gcc/tree-ssa-sccvn.c
===================================================================
*** gcc/tree-ssa-sccvn.c (revision 192120)
--- gcc/tree-ssa-sccvn.c (working copy)
*************** vn_nary_length_from_stmt (gimple stmt)
*** 2194,2199 ****
--- 2194,2202 ----
case VIEW_CONVERT_EXPR:
return 1;
+ case BIT_FIELD_REF:
+ return 3;
+
case CONSTRUCTOR:
return CONSTRUCTOR_NELTS (gimple_assign_rhs1 (stmt));
*************** init_vn_nary_op_from_stmt (vn_nary_op_t
*** 2220,2225 ****
--- 2223,2235 ----
vno->op[0] = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
break;
+ case BIT_FIELD_REF:
+ vno->length = 3;
+ vno->op[0] = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+ vno->op[1] = TREE_OPERAND (gimple_assign_rhs1 (stmt), 1);
+ vno->op[2] = TREE_OPERAND (gimple_assign_rhs1 (stmt), 2);
+ break;
+
case CONSTRUCTOR:
vno->length = CONSTRUCTOR_NELTS (gimple_assign_rhs1 (stmt));
for (i = 0; i < vno->length; ++i)
*************** init_vn_nary_op_from_stmt (vn_nary_op_t
*** 2227,2232 ****
--- 2237,2243 ----
break;
default:
+ gcc_checking_assert (!gimple_assign_single_p (stmt));
vno->length = gimple_num_ops (stmt) - 1;
for (i = 0; i < vno->length; ++i)
vno->op[i] = gimple_op (stmt, i + 1);
Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c (revision 192120)
--- gcc/tree-ssa-pre.c (working copy)
*************** compute_avail (void)
*** 3850,3860 ****
|| code == VEC_COND_EXPR)
continue;
! vn_nary_op_lookup_pieces (gimple_num_ops (stmt) - 1,
! code,
! gimple_expr_type (stmt),
! gimple_assign_rhs1_ptr (stmt),
! &nary);
if (!nary)
continue;
--- 3850,3856 ----
|| code == VEC_COND_EXPR)
continue;
! vn_nary_op_lookup_stmt (stmt, &nary);
if (!nary)
continue;
Index: gcc/tree-ssa-sccvn.h
===================================================================
*** gcc/tree-ssa-sccvn.h (revision 192120)
--- gcc/tree-ssa-sccvn.h (working copy)
*************** typedef const struct vn_nary_op_s *const
*** 51,57 ****
static inline size_t
sizeof_vn_nary_op (unsigned int length)
{
! return sizeof (struct vn_nary_op_s) + sizeof (tree) * (length - 1);
}
/* Phi nodes in the hashtable consist of their non-VN_TOP phi
--- 51,57 ----
static inline size_t
sizeof_vn_nary_op (unsigned int length)
{
! return sizeof (struct vn_nary_op_s) + sizeof (tree) * length - sizeof (tree);
}
/* Phi nodes in the hashtable consist of their non-VN_TOP phi
More information about the Gcc-patches
mailing list