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
This commit is contained in:
Ira Rosen 2012-01-01 13:52:13 +00:00 committed by Ira Rosen
parent 1d2314ed1c
commit f2c74cc43a
5 changed files with 97 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

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