re PR c++/60836 (invalid PHI argument and ICE in verify_gimple)

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.

	* g++.dg/vect/pr60836.cc: New testcase.

From-SVN: r209468
This commit is contained in:
Richard Biener 2014-04-17 08:12:58 +00:00 committed by Richard Biener
parent 1428105c0d
commit 730e78b045
4 changed files with 56 additions and 2 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,39 @@
// { 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" } }

View File

@ -3952,8 +3952,12 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
/* 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. */