Commit 0e93a64e by Ira Rosen Committed by Ira Rosen

re PR tree-optimization/50414 (gfortran -Ofast SIGSEGV in store_constructor)


        PR tree-optimization/50414
        * tree-vect-slp.c (vect_get_constant_vectors): Handle MAX_EXPR
        and MIN_EXPR.

From-SVN: r178941
parent deaf836c
2011-09-18 Ira Rosen <ira.rosen@linaro.org> 2011-09-18 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/50414
* tree-vect-slp.c (vect_get_constant_vectors): Handle MAX_EXPR and
MIN_EXPR.
2011-09-18 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/50412 PR tree-optimization/50412
* tree-vect-data-refs.c (vect_analyze_group_access): Fail for * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
acceses that require epilogue loop if vectorizing outer loop. acceses that require epilogue loop if vectorizing outer loop.
2011-09-18 Ira Rosen <ira.rosen@linaro.org> 2011-09-18 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/50414
* gfortran.dg/vect/Ofast-pr50414.f90: New.
* gfortran.dg/vect/vect.exp: Run Ofast-* tests with -Ofast.
* gcc.dg/vect/no-scevccp-noreassoc-slp-reduc-7.c: New.
2011-09-18 Ira Rosen <ira.rosen@linaro.org>
PR tree-optimization/50412 PR tree-optimization/50412
* gfortran.dg/vect/pr50412.f90: New. * gfortran.dg/vect/pr50412.f90: New.
......
/* { dg-require-effective-target vect_int } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define MAX 121
unsigned int ub[N] = {0,3,6,9,12,15,18,121,24,27,113,33,36,39,42,45};
/* Vectorization of reduction using loop-aware SLP (with unrolling). */
__attribute__ ((noinline))
int main1 (int n)
{
int i;
unsigned int max = 50;
for (i = 0; i < n; i++) {
max = max < ub[2*i] ? ub[2*i] : max;
max = max < ub[2*i + 1] ? ub[2*i + 1] : max;
}
/* Check results: */
if (max != MAX)
abort ();
return 0;
}
int main (void)
{
check_vect ();
main1 (N/2);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_max } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_max } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
! { dg-do compile }
SUBROUTINE SUB (A,L,YMAX)
DIMENSION A(L)
YMA=A(1)
DO 2 I=1,L,2
2 YMA=MAX(YMA,A(I),A(I+1))
CALL PROUND(YMA)
END
! { dg-final { cleanup-tree-dump "vect" } }
...@@ -84,6 +84,12 @@ lappend DEFAULT_VECTCFLAGS "-O3" ...@@ -84,6 +84,12 @@ lappend DEFAULT_VECTCFLAGS "-O3"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]] \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[fF\]{,90,95,03,08} ]] \
"" $DEFAULT_VECTCFLAGS "" $DEFAULT_VECTCFLAGS
# With -Ofast
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
lappend DEFAULT_VECTCFLAGS "-Ofast"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]] \
"" $DEFAULT_VECTCFLAGS
# Clean up. # Clean up.
set dg-do-what-default ${save-dg-do-what-default} set dg-do-what-default ${save-dg-do-what-default}
......
...@@ -1902,6 +1902,8 @@ vect_get_constant_vectors (tree op, slp_tree slp_node, ...@@ -1902,6 +1902,8 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
bool constant_p, is_store; bool constant_p, is_store;
tree neutral_op = NULL; tree neutral_op = NULL;
enum tree_code code = gimple_assign_rhs_code (stmt); enum tree_code code = gimple_assign_rhs_code (stmt);
gimple def_stmt;
struct loop *loop;
if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def) if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)
{ {
...@@ -1943,8 +1945,16 @@ vect_get_constant_vectors (tree op, slp_tree slp_node, ...@@ -1943,8 +1945,16 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
neutral_op = build_int_cst (TREE_TYPE (op), -1); neutral_op = build_int_cst (TREE_TYPE (op), -1);
break; break;
case MAX_EXPR:
case MIN_EXPR:
def_stmt = SSA_NAME_DEF_STMT (op);
loop = (gimple_bb (stmt))->loop_father;
neutral_op = PHI_ARG_DEF_FROM_EDGE (def_stmt,
loop_preheader_edge (loop));
break;
default: default:
neutral_op = NULL; neutral_op = NULL;
} }
} }
...@@ -1997,8 +2007,8 @@ vect_get_constant_vectors (tree op, slp_tree slp_node, ...@@ -1997,8 +2007,8 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
if (reduc_index != -1) if (reduc_index != -1)
{ {
struct loop *loop = (gimple_bb (stmt))->loop_father; loop = (gimple_bb (stmt))->loop_father;
gimple def_stmt = SSA_NAME_DEF_STMT (op); def_stmt = SSA_NAME_DEF_STMT (op);
gcc_assert (loop); gcc_assert (loop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment