+2014-10-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/63379
+ * tree-vect-slp.c (vect_get_constant_vectors): Do not compute
+ a neutral operand for min/max when it is not a reduction chain.
+
2014-10-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/63476
+2014-10-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/63379
+ * gcc.dg/vect/pr63379.c: New testcase.
+
2014-10-10 Jakub Jelinek <jakub@redhat.com>
PR fortran/59488
--- /dev/null
+/* PR tree-optimization/63379 */
+/* { dg-do run } */
+
+#include "tree-vect.h"
+
+extern void abort (void);
+
+typedef struct {
+ int x;
+ int y;
+} Point;
+
+Point pt_array[25];
+
+void __attribute__((noinline,noclone))
+generate_array(void)
+{
+ unsigned int i;
+ for (i = 0; i<25; i++)
+ {
+ pt_array[i].x = i;
+ pt_array[i].y = 1000+i;
+ }
+}
+
+int main()
+{
+ check_vect ();
+ generate_array ();
+ Point min_pt = pt_array[0];
+ Point *ptr, *ptr_end;
+ for (ptr = pt_array+1, ptr_end = pt_array+25; ptr != ptr_end; ++ptr)
+ {
+ min_pt.x = (min_pt.x < ptr->x) ? min_pt.x : ptr->x;
+ min_pt.y = (min_pt.y < ptr->y) ? min_pt.y : ptr->y;
+ }
+
+ if (min_pt.x != 0 || min_pt.y != 1000)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
neutral_op = build_int_cst (TREE_TYPE (op), -1);
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;
+ /* For MIN/MAX we don't have an easy neutral operand but
+ the initial values can be used fine here. Only for
+ a reduction chain we have to force a neutral element. */
+ case MAX_EXPR:
+ case MIN_EXPR:
+ if (!GROUP_FIRST_ELEMENT (stmt_vinfo))
+ neutral_op = NULL;
+ else
+ {
+ 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:
neutral_op = NULL;