diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c0c8cff4b0f6..1906f53720ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-26 Ira Rosen + + PR tree-optimization/46167 + * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Check that there + is basic block for the statement. + 2010-10-26 Paul Koning * config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format): Update to diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 60655c387d5e..762ceead9306 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-10-26 Ira Rosen + + PR tree-optimization/46167 + * gcc.dg/vect/O-pr46167.c: New. + * gcc.dg/vect/vect.exp: Run tests with -O. + 2010-10-26 H.J. Lu PR target/44948 diff --git a/gcc/testsuite/gcc.dg/vect/O-pr46167.c b/gcc/testsuite/gcc.dg/vect/O-pr46167.c new file mode 100644 index 000000000000..490ddd457260 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/O-pr46167.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +int foo (char c, int i) +{ + int s = 0; + while (i--) + s += c; + return s; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index f50574038e89..748234849ca8 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -126,6 +126,11 @@ set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS lappend O1_VECTCFLAGS "-O1" lappend O1_VECTCFLAGS "-fdump-tree-vect-details" +global O_VECTCFLAGS +set O_VECTCFLAGS $DEFAULT_VECTCFLAGS +lappend O_VECTCFLAGS "-O" +lappend O_VECTCFLAGS "-fdump-tree-vect-details" + lappend DEFAULT_VECTCFLAGS "-O2" # Tests that should be run without generating dump info @@ -287,6 +292,10 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O3-*.\[cS\]]] \ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] \ "" $O1_VECTCFLAGS +# With -O +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] \ + "" $O_VECTCFLAGS + # -fno-tree-reassoc set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS lappend VECT_SLP_CFLAGS "-fno-tree-reassoc" diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index ebe00d6210d3..a26cb0b69f6d 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -257,7 +257,7 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out) stmt = SSA_NAME_DEF_STMT (oprnd0); /* It could not be the dot_prod pattern if the stmt is outside the loop. */ - if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt))) + if (!gimple_bb (stmt) || !flow_bb_inside_loop_p (loop, gimple_bb (stmt))) return NULL; /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi