summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-04-16 14:53:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-04-16 14:53:32 +0000
commit646bea10e5f7be362618a8cdcf91d87ea9771fd1 (patch)
tree39a3f83699560f41244729712877b85ac31886a7
parent02e819ffd481be3a48701f535e7daad5ddaaae6a (diff)
downloadgcc-646bea10e5f7be362618a8cdcf91d87ea9771fd1.tar.gz
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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ipa-struct-reorg.c10
-rw-r--r--gcc/tree-cfg.c59
3 files changed, 59 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 04eb70a1d36..b44225048c9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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).
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 9ca53645aa0..8b5360d00e9 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -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;
}
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 447e6cf0a09..2eab9ad10fb 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -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: