tree-cfg.c (verify_gimple_assign_binary): Allow POINTER_PLUS_EXPR-like PLUS_EXPR for vectors.
2009-04-16 Richard Guenther <rguenther@suse.de> * tree-cfg.c (verify_gimple_assign_binary): Allow POINTER_PLUS_EXPR-like PLUS_EXPR for vectors. * ipa-struct-reorg.c (gen_size): Fold the built expressions. (create_general_new_stmt): Note that this function is broken. From-SVN: r146197
This commit is contained in:
parent
02e819ffd4
commit
646bea10e5
@ -1,3 +1,10 @@
|
||||
2009-04-16 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* tree-cfg.c (verify_gimple_assign_binary):
|
||||
Allow POINTER_PLUS_EXPR-like PLUS_EXPR for vectors.
|
||||
* ipa-struct-reorg.c (gen_size): Fold the built expressions.
|
||||
(create_general_new_stmt): Note that this function is broken.
|
||||
|
||||
2009-04-16 Rafael Avila de Espindola <espindola@google.com>
|
||||
|
||||
* common.opt (fhelp): Add Var(help_flag).
|
||||
|
@ -606,13 +606,17 @@ gen_size (tree num, tree type, tree *res)
|
||||
if (exact_log2 (struct_size_int) == -1)
|
||||
{
|
||||
tree size = build_int_cst (TREE_TYPE (num), struct_size_int);
|
||||
new_stmt = gimple_build_assign_with_ops (MULT_EXPR, *res, num, size);
|
||||
new_stmt = gimple_build_assign (*res, fold_build2 (MULT_EXPR,
|
||||
TREE_TYPE (num),
|
||||
num, size));
|
||||
}
|
||||
else
|
||||
{
|
||||
tree C = build_int_cst (TREE_TYPE (num), exact_log2 (struct_size_int));
|
||||
|
||||
new_stmt = gimple_build_assign_with_ops (LSHIFT_EXPR, *res, num, C);
|
||||
new_stmt = gimple_build_assign (*res, fold_build2 (LSHIFT_EXPR,
|
||||
TREE_TYPE (num),
|
||||
num, C));
|
||||
}
|
||||
|
||||
finalize_stmt (new_stmt);
|
||||
@ -1291,6 +1295,8 @@ create_general_new_stmt (struct access_site *acc, tree new_type)
|
||||
{
|
||||
pos = find_pos_in_stmt (new_stmt, var);
|
||||
gcc_assert (pos);
|
||||
/* ??? This misses adjustments to the type of the
|
||||
INDIRECT_REF we possibly replace the operand of. */
|
||||
*pos = new_var;
|
||||
}
|
||||
}
|
||||
|
@ -3568,8 +3568,52 @@ verify_gimple_assign_binary (gimple stmt)
|
||||
return false;
|
||||
}
|
||||
|
||||
case PLUS_EXPR:
|
||||
{
|
||||
/* We use regular PLUS_EXPR for vectors.
|
||||
??? This just makes the checker happy and may not be what is
|
||||
intended. */
|
||||
if (TREE_CODE (lhs_type) == VECTOR_TYPE
|
||||
&& POINTER_TYPE_P (TREE_TYPE (lhs_type)))
|
||||
{
|
||||
if (TREE_CODE (rhs1_type) != VECTOR_TYPE
|
||||
|| TREE_CODE (rhs2_type) != VECTOR_TYPE)
|
||||
{
|
||||
error ("invalid non-vector operands to vector valued plus");
|
||||
return true;
|
||||
}
|
||||
lhs_type = TREE_TYPE (lhs_type);
|
||||
rhs1_type = TREE_TYPE (rhs1_type);
|
||||
rhs2_type = TREE_TYPE (rhs2_type);
|
||||
/* PLUS_EXPR is commutative, so we might end up canonicalizing
|
||||
the pointer to 2nd place. */
|
||||
if (POINTER_TYPE_P (rhs2_type))
|
||||
{
|
||||
tree tem = rhs1_type;
|
||||
rhs1_type = rhs2_type;
|
||||
rhs2_type = tem;
|
||||
}
|
||||
goto do_pointer_plus_expr_check;
|
||||
}
|
||||
}
|
||||
/* Fallthru. */
|
||||
case MINUS_EXPR:
|
||||
{
|
||||
if (POINTER_TYPE_P (lhs_type)
|
||||
|| POINTER_TYPE_P (rhs1_type)
|
||||
|| POINTER_TYPE_P (rhs2_type))
|
||||
{
|
||||
error ("invalid (pointer) operands to plus/minus");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Continue with generic binary expression handling. */
|
||||
break;
|
||||
}
|
||||
|
||||
case POINTER_PLUS_EXPR:
|
||||
{
|
||||
do_pointer_plus_expr_check:
|
||||
if (!POINTER_TYPE_P (rhs1_type)
|
||||
|| !useless_type_conversion_p (lhs_type, rhs1_type)
|
||||
|| !useless_type_conversion_p (sizetype, rhs2_type))
|
||||
@ -3625,21 +3669,6 @@ verify_gimple_assign_binary (gimple stmt)
|
||||
connected to the operand types. */
|
||||
return verify_gimple_comparison (lhs_type, rhs1, rhs2);
|
||||
|
||||
case PLUS_EXPR:
|
||||
case MINUS_EXPR:
|
||||
{
|
||||
if (POINTER_TYPE_P (lhs_type)
|
||||
|| POINTER_TYPE_P (rhs1_type)
|
||||
|| POINTER_TYPE_P (rhs2_type))
|
||||
{
|
||||
error ("invalid (pointer) operands to plus/minus");
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Continue with generic binary expression handling. */
|
||||
break;
|
||||
}
|
||||
|
||||
case WIDEN_SUM_EXPR:
|
||||
case WIDEN_MULT_EXPR:
|
||||
case VEC_WIDEN_MULT_HI_EXPR:
|
||||
|
Loading…
Reference in New Issue
Block a user