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
This commit is contained in:
Dorit Nuzman 2007-03-25 11:08:29 +00:00 committed by Dorit Nuzman
parent 271892929a
commit 5773afc5b5
4 changed files with 55 additions and 2 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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

View File

@ -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" } } */