aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-09-05 12:45:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-09-05 12:45:20 +0000
commite67f39f7c9e7f41c777ef112a7272935b24c45a1 (patch)
tree7aff883a181fa99ca1a426dfe5c9cfb9bc761730 /gcc
parent568cda29c5a4ffb086d8308745ae8b86427dab61 (diff)
downloadgcc-e67f39f7c9e7f41c777ef112a7272935b24c45a1.zip
gcc-e67f39f7c9e7f41c777ef112a7272935b24c45a1.tar.gz
gcc-e67f39f7c9e7f41c777ef112a7272935b24c45a1.tar.bz2
re PR tree-optimization/58137 ([trunk, ICE] full unroll + AVX2 vectorization)
2013-09-05 Richard Biener <rguenther@suse.de> PR tree-optimization/58137 * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Do not create vectors of pointers. * tree-vect-loop.c (get_initial_def_for_induction): Use proper types for the components of the vector initializer. * tree-cfg.c (verify_gimple_assign_binary): Remove special-casing allowing pointer vectors with PLUS_EXPR/MINUS_EXPR. * gcc.target/i386/pr58137.c: New testcase. From-SVN: r202282
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr58137.c33
-rw-r--r--gcc/tree-cfg.c31
-rw-r--r--gcc/tree-vect-loop.c16
-rw-r--r--gcc/tree-vect-stmts.c3
6 files changed, 67 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d7b6bfa..7374a85 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2013-09-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58137
+ * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
+ Do not create vectors of pointers.
+ * tree-vect-loop.c (get_initial_def_for_induction): Use proper
+ types for the components of the vector initializer.
+ * tree-cfg.c (verify_gimple_assign_binary): Remove special-casing
+ allowing pointer vectors with PLUS_EXPR/MINUS_EXPR.
+
2013-09-05 Martin Jambor <mjambor@suse.cz>
* ipa-prop.c (remove_described_reference): Accept missing references,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5431d21..d34ee5e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-05 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58137
+ * gcc.target/i386/pr58137.c: New testcase.
+
2013-09-05 Martin Jambor <mjambor@suse.cz>
* g++.dg/ipa/remref-1.C: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr58137.c b/gcc/testsuite/gcc.target/i386/pr58137.c
new file mode 100644
index 0000000..0a7daf8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr58137.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx2" } */
+
+typedef unsigned int U32;
+
+struct sv {
+ void* sv_any;
+ U32 sv_refcnt;
+ U32 sv_flags;
+};
+typedef struct sv SV;
+
+struct xrv {
+ SV * xrv_rv;
+};
+typedef struct xrv XRV;
+
+extern XRV * PL_xrv_root;
+
+void
+more_xrv (void)
+{
+ register XRV* xrv;
+ register XRV* xrvend;
+ xrv = PL_xrv_root;
+ xrvend = &xrv[200 / sizeof (XRV) - 1];
+ while (xrv < xrvend)
+ {
+ xrv->xrv_rv = (SV*)(xrv + 1);
+ xrv++;
+ }
+ xrv->xrv_rv = 0;
+}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index bc1e1ba..c74b988 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3571,11 +3571,10 @@ verify_gimple_assign_binary (gimple stmt)
case PLUS_EXPR:
case MINUS_EXPR:
{
- /* We use regular PLUS_EXPR and MINUS_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)))
+ tree lhs_etype = lhs_type;
+ tree rhs1_etype = rhs1_type;
+ tree rhs2_etype = rhs2_type;
+ if (TREE_CODE (lhs_type) == VECTOR_TYPE)
{
if (TREE_CODE (rhs1_type) != VECTOR_TYPE
|| TREE_CODE (rhs2_type) != VECTOR_TYPE)
@@ -3583,22 +3582,13 @@ verify_gimple_assign_binary (gimple stmt)
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;
+ lhs_etype = TREE_TYPE (lhs_type);
+ rhs1_etype = TREE_TYPE (rhs1_type);
+ rhs2_etype = TREE_TYPE (rhs2_type);
}
- if (POINTER_TYPE_P (lhs_type)
- || POINTER_TYPE_P (rhs1_type)
- || POINTER_TYPE_P (rhs2_type))
+ if (POINTER_TYPE_P (lhs_etype)
+ || POINTER_TYPE_P (rhs1_etype)
+ || POINTER_TYPE_P (rhs2_etype))
{
error ("invalid (pointer) operands to plus/minus");
return true;
@@ -3610,7 +3600,6 @@ verify_gimple_assign_binary (gimple stmt)
case POINTER_PLUS_EXPR:
{
-do_pointer_plus_expr_check:
if (!POINTER_TYPE_P (rhs1_type)
|| !useless_type_conversion_p (lhs_type, rhs1_type)
|| !ptrofftype_p (rhs2_type))
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 762a894..9b4b189 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3133,7 +3133,6 @@ get_initial_def_for_induction (gimple iv_phi)
stmt_vec_info stmt_vinfo = vinfo_for_stmt (iv_phi);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- tree scalar_type;
tree vectype;
int nunits;
edge pe = loop_preheader_edge (loop);
@@ -3185,8 +3184,7 @@ get_initial_def_for_induction (gimple iv_phi)
gcc_assert (ok);
pe = loop_preheader_edge (iv_loop);
- scalar_type = TREE_TYPE (init_expr);
- vectype = get_vectype_for_scalar_type (scalar_type);
+ vectype = get_vectype_for_scalar_type (TREE_TYPE (init_expr));
resvectype = get_vectype_for_scalar_type (TREE_TYPE (PHI_RESULT (iv_phi)));
gcc_assert (vectype);
nunits = TYPE_VECTOR_SUBPARTS (vectype);
@@ -3229,8 +3227,11 @@ get_initial_def_for_induction (gimple iv_phi)
/* iv_loop is the loop to be vectorized. Create:
vec_init = [X, X+S, X+2*S, X+3*S] (S = step_expr, X = init_expr) */
- new_var = vect_get_new_vect_var (scalar_type, vect_scalar_var, "var_");
- new_name = force_gimple_operand (init_expr, &stmts, false, new_var);
+ new_var = vect_get_new_vect_var (TREE_TYPE (vectype),
+ vect_scalar_var, "var_");
+ new_name = force_gimple_operand (fold_convert (TREE_TYPE (vectype),
+ init_expr),
+ &stmts, false, new_var);
if (stmts)
{
new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
@@ -3243,9 +3244,8 @@ get_initial_def_for_induction (gimple iv_phi)
for (i = 1; i < nunits; i++)
{
/* Create: new_name_i = new_name + step_expr */
- enum tree_code code = POINTER_TYPE_P (scalar_type)
- ? POINTER_PLUS_EXPR : PLUS_EXPR;
- new_name = fold_build2 (code, scalar_type, new_name, step_expr);
+ new_name = fold_build2 (PLUS_EXPR, TREE_TYPE (new_name),
+ new_name, step_expr);
if (!is_gimple_min_invariant (new_name))
{
init_stmt = gimple_build_assign (new_var, new_name);
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 7b8e708..bc4ea1e 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -6203,8 +6203,7 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size)
corresponding to that mode. The theory is that any use that
would cause problems with this will disable vectorization anyway. */
else if (!SCALAR_FLOAT_TYPE_P (scalar_type)
- && !INTEGRAL_TYPE_P (scalar_type)
- && !POINTER_TYPE_P (scalar_type))
+ && !INTEGRAL_TYPE_P (scalar_type))
scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
/* We can't build a vector type of elements with alignment bigger than