------- Comment #10 from steven at gcc dot gnu dot org 2008-02-03 13:19 -------
The following code from simplify_if_then_else() triggers:
/* Look for cases where we have (abs x) or (neg (abs X)). */
if (GET_MODE_CLASS (mode) == MODE_INT
&& GET_CODE (false_rtx) == NEG
&& rtx_equal_p (true_rtx, XEXP (false_rtx, 0))
&& comparison_p
&& rtx_equal_p (true_rtx, XEXP (cond, 0))
&& ! side_effects_p (true_rtx))
switch (true_code)
{
case GT:
case GE:
return simplify_gen_unary (ABS, mode, true_rtx, mode);
case LT:
case LE:
return
simplify_gen_unary (NEG, mode,
simplify_gen_unary (ABS, mode, true_rtx, mode),
mode);
default:
break;
}
with:
true_code = LT
cond == (lt (reg/v:SI 94 [ i ]) (reg:SI 98))
true_rtx == (reg/v:SI 94 [ i ])
false_rtx == (neg:SI (reg/v:SI 94 [ i ]))
or in human understandable language: "if (i < reg_98) i = i; else i = -1;"
We end up returning "(neg (abs:SI (reg/v:SI 94 [ i ])))".
The problem is that the if-condition in the quoted code does not look at what
is being compared against. There should be a test to make sure the comparison
is against const0_rtx.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34627