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.
{
/* 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;
/* 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.
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.
--- /dev/null
+/* 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))));
+}