re PR tree-optimization/82603 (ICE in ifcvt_local_dce w/ -O2 -ftree-loop-vectorize)

2017-10-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/82603
	* tree-if-conv.c (predicate_mem_writes): Make sure to only
	remove false predicated stores.

	* gcc.dg/torture/pr82603.c: New testcase.

From-SVN: r253932
This commit is contained in:
Richard Biener 2017-10-20 11:19:03 +00:00 committed by Richard Biener
parent 29ad09f6a8
commit 47ffadd915
4 changed files with 37 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-10-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/82603
* tree-if-conv.c (predicate_mem_writes): Make sure to only
remove false predicated stores.
2017-10-20 Richard Biener <rguenther@suse.de>
Backport from mainline

View File

@ -1,3 +1,8 @@
2017-10-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/82603
* gcc.dg/torture/pr82603.c: New testcase.
2017-10-20 Richard Biener <rguenther@suse.de>
Backport from mainline

View File

@ -0,0 +1,24 @@
/* { dg-do compile } */
/* { dg-additional-options "-ftree-loop-vectorize" } */
int
mr (unsigned int lf, int ms)
{
unsigned int sw = 0;
char *cu = (char *)&ms;
while (ms < 1)
{
if (lf == 0)
ms = 0;
else
ms = 0;
ms += ((lf > 0) && ((lf > sw) ? 1 : ++*cu));
}
if (lf != 0)
cu = (char *)&sw;
*cu = lf;
return ms;
}

View File

@ -2215,7 +2215,8 @@ predicate_mem_writes (loop_p loop)
{
if (!gimple_assign_single_p (stmt = gsi_stmt (gsi)))
;
else if (is_false_predicate (cond))
else if (is_false_predicate (cond)
&& gimple_vdef (stmt))
{
unlink_stmt_vdef (stmt);
gsi_remove (&gsi, true);