re PR rtl-optimization/23047 (Combine ignores flag_wrapv)

2005-07-27  James A. Morrison  <phython@gcc.gnu.org>

        PR rtl-optimization/23047
        * simplify-rtx.c (simplify_const_relational_operation): Respect
        flag_wrapv for comparisons with ABS.

From-SVN: r102459
This commit is contained in:
James A. Morrison 2005-07-28 04:40:05 +00:00
parent ff08cbee5d
commit 77d1d8e01f
5 changed files with 37 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-07-25 James A. Morrison <phython@gcc.gnu.org>
PR rtl-optimization/23047
* simplify-rtx.c (simplify_const_relational_operation): Respect
flag_wrapv for comparisons with ABS.
2005-07-27 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/22493

View File

@ -3236,7 +3236,9 @@ simplify_const_relational_operation (enum rtx_code code,
case LT:
/* Optimize abs(x) < 0.0. */
if (trueop1 == CONST0_RTX (mode) && !HONOR_SNANS (mode))
if (trueop1 == CONST0_RTX (mode)
&& !HONOR_SNANS (mode)
&& !(flag_wrapv && INTEGRAL_MODE_P (mode)))
{
tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
: trueop0;
@ -3247,7 +3249,9 @@ simplify_const_relational_operation (enum rtx_code code,
case GE:
/* Optimize abs(x) >= 0.0. */
if (trueop1 == CONST0_RTX (mode) && !HONOR_NANS (mode))
if (trueop1 == CONST0_RTX (mode)
&& !HONOR_NANS (mode)
&& !(flag_wrapv && INTEGRAL_MODE_P (mode)))
{
tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
: trueop0;

View File

@ -1,6 +1,12 @@
2005-07-27 James A. Morrison <phython@gcc.gnu.org>
PR rtl-optimization/22493
PR rtl-optimization/23047
* gcc.c-torture/execute/pr23047.c: New test.
* gcc.c-torture/execute/pr23047.x: New.
2005-07-27 James A. Morrison <phython@gcc.gnu.org>
PR tree-optimization/22493
* gcc.c-torture/execute/pr22493-1.c: New test.
* gcc.c-torture/execute/pr22493-1.x: New.
* gcc.c-torture/execute/vrp-1.c: New test.

View File

@ -0,0 +1,16 @@
#include <limits.h>
extern void abort ();
extern void exit (int);
void f(int i)
{
i = i > 0 ? i : -i;
if (i<0)
return;
abort ();
}
int main(int argc, char *argv[])
{
f(INT_MIN);
exit (0);
}

View File

@ -0,0 +1,2 @@
set additional_flags "-fwrapv"
return 0