aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDorit Nuzman <dorit@il.ibm.com>2007-03-25 11:08:29 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2007-03-25 11:08:29 +0000
commit5773afc5b5b659bc20842e72627b492023d65cb5 (patch)
tree7b5379e8c48e4e39c5a32337205ad98c5b5e7d24 /gcc
parent271892929a448a2bad2fa83e5652958d1af3f1a4 (diff)
downloadgcc-5773afc5b5b659bc20842e72627b492023d65cb5.zip
gcc-5773afc5b5b659bc20842e72627b492023d65cb5.tar.gz
gcc-5773afc5b5b659bc20842e72627b492023d65cb5.tar.bz2
re PR middle-end/30784 (ICE on loop vectorization (-O1 -march=athlon-xp -ftree-vectorize))
PR tree-optimization/30784 * fold-const.c (fold_ternary): Handle CONSTRUCTOR in case BIT_FIELD_REF. From-SVN: r123197
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fold-const.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr30784.c30
4 files changed, 55 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8902bf..fa1e4b3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-25 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/30784
+ * fold-const.c (fold_ternary): Handle CONSTRUCTOR in case
+ BIT_FIELD_REF.
+
2007-03-25 Revital Eres <eres@il.ibm.com>
* tree-if-conv.c (if_convertible_gimple_modify_stmt_p):
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e4efda0..66bcbbc 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12470,7 +12470,8 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
gcc_unreachable ();
case BIT_FIELD_REF:
- if (TREE_CODE (arg0) == VECTOR_CST
+ if ((TREE_CODE (arg0) == VECTOR_CST
+ || (TREE_CODE (arg0) == CONSTRUCTOR && TREE_CONSTANT (arg0)))
&& type == TREE_TYPE (TREE_TYPE (arg0))
&& host_integerp (arg1, 1)
&& host_integerp (op2, 1))
@@ -12484,7 +12485,18 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
&& (idx = idx / width)
< TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)))
{
- tree elements = TREE_VECTOR_CST_ELTS (arg0);
+ tree elements = NULL_TREE;
+
+ if (TREE_CODE (arg0) == VECTOR_CST)
+ elements = TREE_VECTOR_CST_ELTS (arg0);
+ else
+ {
+ unsigned HOST_WIDE_INT idx;
+ tree value;
+
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg0), idx, value)
+ elements = tree_cons (NULL_TREE, value, elements);
+ }
while (idx-- > 0 && elements)
elements = TREE_CHAIN (elements);
if (elements)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8bd087a..d8b23d8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-25 Dorit Nuzman <dorit@il.ibm.com>
+
+ PR tree-optimization/30784
+ * gcc.dg/vect/pr30784.c: New test.
+
2007-03-25 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/30877
diff --git a/gcc/testsuite/gcc.dg/vect/pr30784.c b/gcc/testsuite/gcc.dg/vect/pr30784.c
new file mode 100644
index 0000000..3df9afe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr30784.c
@@ -0,0 +1,30 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+long stack_vars_sorted[32];
+
+int
+main1 (long n)
+{
+ long si;
+
+ for (si = 0; si < n; ++si)
+ stack_vars_sorted[si] = si;
+}
+
+int main ()
+{
+ long si;
+
+ check_vect ();
+ main1 (32);
+
+ for (si = 0; si < 32; ++si)
+ if (stack_vars_sorted[si] != si)
+ abort ();
+
+ return 0;
+}
+/* { dg-final { cleanup-tree-dump "vect" } } */