Commit af421d9c by Jakub Jelinek Committed by Jakub Jelinek

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
parent 707f9919
2011-07-04 Jakub Jelinek <jakub@redhat.com> 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 PR rtl-optimization/49472
* simplify-rtx.c (simplify_unary_operation_1) <case NEG>: When * simplify-rtx.c (simplify_unary_operation_1) <case NEG>: When
negating MULT, negate the second operand instead of first. negating MULT, negate the second operand instead of first.
......
...@@ -5681,12 +5681,17 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest, ...@@ -5681,12 +5681,17 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
{ {
/* Try to simplify the expression further. */ /* Try to simplify the expression further. */
rtx tor = simplify_gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); 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 /* If we could, great. If not, do not go ahead with the IOR
replacement, since PLUS appears in many special purpose replacement, since PLUS appears in many special purpose
address arithmetic instructions. */ 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; return temp;
} }
break; break;
......
/* RTL simplification functions for GNU compiler. /* RTL simplification functions for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
Free Software Foundation, Inc. 2011 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
......
2011-07-04 Jakub Jelinek <jakub@redhat.com> 2011-07-04 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/49619
* gcc.dg/pr49619.c: New test.
PR rtl-optimization/49472 PR rtl-optimization/49472
* gfortran.dg/pr49472.f90: New test. * gfortran.dg/pr49472.f90: New test.
......
/* 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))));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment