re PR rtl-optimization/59647 (ICE in simplify_const_unary_operation, at simplify-rtx.c:1597)

PR rtl-optimization/59647
	* cse.c (cse_process_notes_1): Don't substitute negative VOIDmode
	new_rtx into UNSIGNED_FLOAT rtxes.

	* g++.dg/opt/pr59647.C: New test.

From-SVN: r206267
This commit is contained in:
Jakub Jelinek 2014-01-01 00:48:36 +01:00 committed by Jakub Jelinek
parent 075691af6b
commit dfebbdc61f
6 changed files with 52952 additions and 52887 deletions

File diff suppressed because it is too large Load diff

40495
gcc/ChangeLog-2013 Normal file

File diff suppressed because it is too large Load diff

View file

@ -6090,6 +6090,18 @@ cse_process_notes_1 (rtx x, rtx object, bool *changed)
return x;
}
case UNSIGNED_FLOAT:
{
rtx new_rtx = cse_process_notes (XEXP (x, 0), object, changed);
/* We don't substitute negative VOIDmode constants into these rtx,
since they would impede folding. */
if (GET_MODE (new_rtx) != VOIDmode
|| (CONST_INT_P (new_rtx) && INTVAL (new_rtx) >= 0)
|| (CONST_DOUBLE_P (new_rtx) && CONST_DOUBLE_HIGH (new_rtx) >= 0))
validate_change (object, &XEXP (x, 0), new_rtx, 0);
return x;
}
case REG:
i = REG_QTY (REGNO (x));

File diff suppressed because it is too large Load diff

12406
gcc/testsuite/ChangeLog-2013 Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
// PR rtl-optimization/59647
// { dg-do compile }
// { dg-options "-O2 -fno-tree-vrp" }
// { dg-additional-options "-msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ia32 } } }
void f1 (int);
void f2 ();
double f3 (int);
struct A
{
int f4 () const
{
if (a == 0)
return 1;
return 0;
}
unsigned f5 ()
{
if (!f4 ())
f2 ();
return a;
}
int a;
};
void
f6 (A *x)
{
unsigned b = x->f5 ();
f1 (b - 1 - f3 (x->f5 () - 1U));
}