[Bug middle-end/31096] a*C == b*C where C is a constant is not optimized to a == b
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Fri Mar 9 12:06:00 GMT 2007
------- Comment #2 from joseph at codesourcery dot com 2007-03-09 12:06 -------
Subject: Re: New: a*C == b*C where C is a constant
is not optimized to a == b
On Fri, 9 Mar 2007, pinskia at gcc dot gnu dot org wrote:
> The following two functions should be equzlivant when overflow is undefined:
> int f(int a, int b)
> {
> return a * 10 == b*10;
> }
>
> int f1(int a, int b)
> {
> return a==b;
> }
If the constant is odd, they are equivalent for wrapping (but not for
trapping) and for unsigned as well.
(If the constant is 0, they aren't equivalent at all but the first should
become "return 1;".)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31096
More information about the Gcc-bugs
mailing list