[patch] gcse.c (expr_equiv_p): Very tiny speedup.
Mark Mitchell
mark@codesourcery.com
Wed Jul 2 03:55:00 GMT 2003
On Fri, 2003-06-27 at 05:46, Kazu Hirata wrote:
> Hi,
>
> Attached is a patch to speed up expr_equiv_p().
>
> CONST_INT's are always shared, so
>
> INTVAL (x) == INTVAL (y) iff x == y
>
> Since the function returns 1 very early if x == y, after that we
> know that INTVAL (x) != INTVAL (y).
>
> Tested on i686-pc-linux-gnu. OK to apply?
Yes, this is OK -- but please add a comment in the CONST_INT case that
says:
/* Because CONST_INTs are always shared, and because we have already
checked for address equality, the values must be different. */
There's no harm in making this kind of stuff obvious!
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
More information about the Gcc-patches
mailing list