This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] Do pointer comparison first in operand_equal_p
On Fri, May 13, 2005 at 09:19:42AM -0600, Roger Sayle wrote:
> The problem that I see with this is its interaction with the
> OEP_CONST_ONLY and OEP_PURE_SAME flags.
Both OEP_CONST_ONLY and OEP_PURE_SAME ought to not have
side-effects, right? The only thing that was pointed out that
may give different behaviour is ERROR_MARK, but that can be fixed
by making ERROR_MARK have side-effects (if it doesn't already).
> The side-effect is that this increases the critical path length of
> operand_equal_p, which is heavily used.
But it also makes it a bit faster, as I just timed it.
> Perhaps a better approach would be to split up the two
> functionalities, into operand_equal_p and constant_equal_p (and
> maybe pure_call_equal_p) such that each implementation attempts
> to reuse as much as possible, but its optimized for it's
> particular usage.
> i.e. operand_equal_p could call constant_equal_p for constants,
> allowing the pointer comparison to occur first in the former.
Hmm, I'm looking at the problem as a customer of fold-const.c,
not a provider :)
If you don't think this is a safe change, would you be willing to
provide this minor speedup I obtained in some other way?
> As written your patch may break stuff.
OK, though I'm not interested in guessing what it may break.
Have a test case in mind?