+2014-04-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60836
+ * tree-vect-loop.c (vect_create_epilog_for_reduction): Force
+ initial PHI args to be gimple values.
+
2014-04-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/60841
+2014-04-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60836
+ * g++.dg/vect/pr60836.cc: New testcase.
+
2014-04-17 Richard Biener <rguenther@suse.de>
PR tree-optimization/60841
--- /dev/null
+// { dg-do compile }
+
+int a, b;
+typedef double (*NormFunc) (const int &);
+int &
+max (int &p1, int &p2)
+{
+ if (p1 < p2)
+ return p2;
+ return p1;
+}
+
+struct A
+{
+ int operator () (int p1, int p2)
+ {
+ return max (p1, p2);
+ }
+};
+template < class, class > double
+norm_ (const int &)
+{
+ char c, d;
+ A e;
+ for (; a; a++)
+ {
+ b = e (b, d);
+ b = e (b, c);
+ }
+}
+
+void
+norm ()
+{
+ static NormFunc f = norm_ < int, A >;
+ f = 0;
+}
+
+// { dg-final { cleanup-tree-dump "vect" } }
/* Set phi nodes arguments. */
FOR_EACH_VEC_ELT (reduction_phis, i, phi)
{
- tree vec_init_def = vec_initial_defs[i];
- tree def = vect_defs[i];
+ tree vec_init_def, def;
+ gimple_seq stmts;
+ vec_init_def = force_gimple_operand (vec_initial_defs[i], &stmts,
+ true, NULL_TREE);
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ def = vect_defs[i];
for (j = 0; j < ncopies; j++)
{
/* Set the loop-entry arg of the reduction-phi. */