Message ID | 201009101157.o8ABvSFh016246@ignucius.se.axis.com |
---|---|
State | New |
Headers | show |
On Fri, Sep 10, 2010 at 1:57 PM, Hans-Peter Nilsson <hans-peter.nilsson@axis.com> wrote: > PR rtl-optimization/41087 > * ifcvt.c (noce_get_condition): Don't allow conditions with > side-effects. > > Index: ifcvt.c > =================================================================== > --- ifcvt.c (revision 164149) > +++ ifcvt.c (working copy) > @@ -2201,8 +2201,15 @@ noce_get_condition (rtx jump, rtx *earli > > /* Otherwise, fall back on canonicalize_condition to do the dirty > work of manipulating MODE_CC values and COMPARE rtx codes. */ > - return canonicalize_condition (jump, cond, reverse, earliest, > - NULL_RTX, false, true); > + tmp = canonicalize_condition (jump, cond, reverse, earliest, > + NULL_RTX, false, true); > + > + /* We don't handle side-effects in the condition, like handling > + REG_INC notes and making sure no duplicate conditions are emitted. */ > + if (tmp != NULL_RTX && side_effects_p (tmp)) > + return NULL_RTX; > + > + return tmp; > } > > /* Return true if OP is ok for if-then-else processing. */ > Can you not already see side effects _before_ canonicalize_condition? Ciao! Steven
> PR rtl-optimization/41087 > * ifcvt.c (noce_get_condition): Don't allow conditions with > side-effects. OK for trunk and 4.5 branch.
Index: ifcvt.c =================================================================== --- ifcvt.c (revision 164149) +++ ifcvt.c (working copy) @@ -2201,8 +2201,15 @@ noce_get_condition (rtx jump, rtx *earli /* Otherwise, fall back on canonicalize_condition to do the dirty work of manipulating MODE_CC values and COMPARE rtx codes. */ - return canonicalize_condition (jump, cond, reverse, earliest, - NULL_RTX, false, true); + tmp = canonicalize_condition (jump, cond, reverse, earliest, + NULL_RTX, false, true); + + /* We don't handle side-effects in the condition, like handling + REG_INC notes and making sure no duplicate conditions are emitted. */ + if (tmp != NULL_RTX && side_effects_p (tmp)) + return NULL_RTX; + + return tmp; } /* Return true if OP is ok for if-then-else processing. */