aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIra Rosen <irar@il.ibm.com>2012-01-01 13:52:13 +0000
committerIra Rosen <irar@gcc.gnu.org>2012-01-01 13:52:13 +0000
commitf2c74cc43a137f5fe81719b4b1514a665bff8766 (patch)
tree39604a554502660fbe8328eaba9da6d7ec6570a3 /gcc
parent1d2314ed1c90db68ee4e0e4c603773f5bc258f0b (diff)
downloadgcc-f2c74cc43a137f5fe81719b4b1514a665bff8766.zip
gcc-f2c74cc43a137f5fe81719b4b1514a665bff8766.tar.gz
gcc-f2c74cc43a137f5fe81719b4b1514a665bff8766.tar.bz2
re PR tree-optimization/51704 (ICE: vector VEC(vec_void_p,base) index domain error, in vinfo_for_stmt at tree-vectorizer.h:620 with -O3 -fno-tree-copy-prop -fno-tree-fre)
PR tree-optimization/51704 * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Check that a use is inside the basic block or loop before accessing its vect info. From-SVN: r182769
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f9057
-rw-r--r--gcc/testsuite/gfortran.dg/vect/vect.exp6
-rw-r--r--gcc/tree-vect-slp.c27
5 files changed, 97 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f0a850d..d2989d4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-01 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/51704
+ * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Check that
+ a use is inside the basic block or loop before accessing its
+ vect info.
+
2012-01-01 Jan Hubicka <jhjh@suse.cz>
PR rtl-optimization/51069
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9b6c8e5..143c0d1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-01 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/51704
+ * gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90: New.
+ * gfortran.dg/vect/vect.exp: Run no-fre-no-copy-prop-O3-* with
+ corresponding flags.
+
2012-01-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51723
diff --git a/gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90 b/gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90
new file mode 100644
index 0000000..acfe1b7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90
@@ -0,0 +1,57 @@
+! { dg-do compile }
+
+ integer, parameter :: q = 2
+ integer, parameter :: nx=3, ny=2*q, nz=5
+ integer, parameter, dimension(nx,ny,nz) :: p = &
+ & reshape ((/ (i**2, i=1,size(p)) /), shape(p))
+ integer, parameter, dimension( ny,nz) :: px = &
+ & reshape ((/ (( &
+ & + nx*(nx-1)*(2*nx-1)/6, &
+ & j=0,ny-1), k=0,nz-1) /), shape(px))
+ integer, parameter, dimension(nx, nz) :: py = &
+ & reshape ((/ (( &
+ & +(nx )**2*ny*(ny-1)*(2*ny-1)/6, &
+ & i=0,nx-1), k=0,nz-1) /), shape(py))
+ integer, parameter, dimension(nx,ny ) :: pz = &
+ & reshape ((/ (( &
+ & +(nx*ny)**2*nz*(nz-1)*(2*nz-1)/6, &
+ & i=0,nx-1), j=0,ny-1) /), shape(pz))
+ integer, dimension(nx,ny,nz) :: a
+ integer, dimension(nx,ny ) :: az
+ if (sum(sum(sum(a,1),2),1) /= sum(a)) call abort
+ if (sum(sum(sum(a,3),1),1) /= sum(a)) call abort
+ if (any(1+sum(eid(a),1)+ax+sum( &
+ neid3(a), &
+ 1)+1 /= 3*ax+2)) call abort
+ if (any(1+eid(sum(a,2))+ay+ &
+ neid2( &
+ sum(a,2) &
+ )+1 /= 3*ay+2)) call abort
+ if (any(sum(eid(sum(a,3))+az+2* &
+ neid2(az) &
+ ,1)+1 /= 4*sum(az,1)+1)) call abort
+contains
+ elemental function eid (x)
+ integer, intent(in) :: x
+ end function eid
+ function neid2 (x)
+ integer, intent(in) :: x(:,:)
+ integer :: neid2(size(x,1),size(x,2))
+ neid2 = x
+ end function neid2
+ function neid3 (x)
+ integer, intent(in) :: x(:,:,:)
+ integer :: neid3(size(x,1),size(x,2),size(x,3))
+ end function neid3
+ elemental subroutine set (o, i)
+ integer, intent(in) :: i
+ integer, intent(out) :: o
+ end subroutine set
+ elemental subroutine tes (i, o)
+ integer, intent(in) :: i
+ integer, intent(out) :: o
+ end subroutine tes
+end
+
+! { dg-final { cleanup-tree-dump "vect" } }
+
diff --git a/gcc/testsuite/gfortran.dg/vect/vect.exp b/gcc/testsuite/gfortran.dg/vect/vect.exp
index 048e57d..f00b257 100644
--- a/gcc/testsuite/gfortran.dg/vect/vect.exp
+++ b/gcc/testsuite/gfortran.dg/vect/vect.exp
@@ -90,6 +90,12 @@ lappend DEFAULT_VECTCFLAGS "-Ofast"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]] \
"" $DEFAULT_VECTCFLAGS
+# With -fno-tree-copy-prop -fno-tree-fre -O3
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fno-tree-copy-prop" "-fno-tree-fre" "-O3"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-no-copy-prop-O3-*.\[fF\]{,90,95,03,08} ]] \
+ "" $DEFAULT_VECTCFLAGS
+
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 91ed0c7..ab1914a 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1,5 +1,5 @@
/* SLP - Basic Block Vectorization
- Copyright (C) 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Dorit Naishlos <dorit@il.ibm.com>
and Ira Rosen <irar@il.ibm.com>
@@ -1727,26 +1727,39 @@ static void
vect_detect_hybrid_slp_stmts (slp_tree node)
{
int i;
- gimple stmt;
+ VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (node);
+ gimple stmt = VEC_index (gimple, stmts, 0);
imm_use_iterator imm_iter;
gimple use_stmt;
- stmt_vec_info stmt_vinfo;
+ stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
slp_void_p child;
+ loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
+ struct loop *loop = NULL;
+ bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo);
+ basic_block bb = NULL;
if (!node)
return;
+ if (loop_vinfo)
+ loop = LOOP_VINFO_LOOP (loop_vinfo);
+ else
+ bb = BB_VINFO_BB (bb_vinfo);
+
FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), i, stmt)
if (PURE_SLP_STMT (vinfo_for_stmt (stmt))
&& TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME)
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0))
- if ((stmt_vinfo = vinfo_for_stmt (use_stmt))
+ if (gimple_bb (use_stmt)
+ && ((loop && flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
+ || bb == gimple_bb (use_stmt))
+ && (stmt_vinfo = vinfo_for_stmt (use_stmt))
&& !STMT_SLP_TYPE (stmt_vinfo)
&& (STMT_VINFO_RELEVANT (stmt_vinfo)
|| VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo)))
- && !(gimple_code (use_stmt) == GIMPLE_PHI
- && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (use_stmt))
- == vect_reduction_def))
+ && !(gimple_code (use_stmt) == GIMPLE_PHI
+ && STMT_VINFO_DEF_TYPE (stmt_vinfo)
+ == vect_reduction_def))
vect_mark_slp_stmts (node, hybrid, i);
FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)