re PR rtl-optimization/49619 (ICE in simplify_subreg, at simplify-rtx.c:5362)

PR rtl-optimization/49619
	* combine.c (combine_simplify_rtx): In PLUS -> IOR simplification
	pass VOIDmode as op0_mode to recursive call, and return temp even
	when different from tor, just if it is not IOR of the original
	PLUS arguments.

	* gcc.dg/pr49619.c: New test.

From-SVN: r175825
This commit is contained in:
Jakub Jelinek 2011-07-04 23:04:54 +02:00 committed by Jakub Jelinek
parent 707f991907
commit af421d9cf0
5 changed files with 31 additions and 4 deletions

View file

@ -1,5 +1,11 @@
2011-07-04 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/49619
* combine.c (combine_simplify_rtx): In PLUS -> IOR simplification
pass VOIDmode as op0_mode to recursive call, and return temp even
when different from tor, just if it is not IOR of the original
PLUS arguments.
PR rtl-optimization/49472
* simplify-rtx.c (simplify_unary_operation_1) <case NEG>: When
negating MULT, negate the second operand instead of first.

View file

@ -5681,12 +5681,17 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
{
/* Try to simplify the expression further. */
rtx tor = simplify_gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1));
temp = combine_simplify_rtx (tor, mode, in_dest, 0);
temp = combine_simplify_rtx (tor, VOIDmode, in_dest, 0);
/* If we could, great. If not, do not go ahead with the IOR
replacement, since PLUS appears in many special purpose
address arithmetic instructions. */
if (GET_CODE (temp) != CLOBBER && temp != tor)
if (GET_CODE (temp) != CLOBBER
&& (GET_CODE (temp) != IOR
|| ((XEXP (temp, 0) != XEXP (x, 0)
|| XEXP (temp, 1) != XEXP (x, 1))
&& (XEXP (temp, 0) != XEXP (x, 1)
|| XEXP (temp, 1) != XEXP (x, 0)))))
return temp;
}
break;

View file

@ -1,7 +1,7 @@
/* RTL simplification functions for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011 Free Software Foundation, Inc.
This file is part of GCC.

View file

@ -1,5 +1,8 @@
2011-07-04 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/49619
* gcc.dg/pr49619.c: New test.
PR rtl-optimization/49472
* gfortran.dg/pr49472.f90: New test.

View file

@ -0,0 +1,13 @@
/* PR rtl-optimization/49619 */
/* { dg-do compile } */
/* { dg-options "-O -fno-tree-fre" } */
extern int a, b;
void
foo (int x)
{
a = 2;
b = 0;
b = (a && ((a = 1, 0 >= b) || (short) (x + (b & x))));
}