This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/73285] perhaps avoid duplication for function of argument order (double, int) or (int, double)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=73285

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|perhaps avoid duplication?  |perhaps avoid duplication
                   |                            |for function of argument
                   |                            |order (double, int) or
                   |                            |(int, double)

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Really I can see the following to be done (which does not optimize it fully but
can then be done as aliases at the target level).

Take a more complex example:
int f0(int a, int *b)
{
  return b[a];
}

int f1(int *b, int a)
{
  return b[a];
}

--- CUT ---
An IPA pass could figure out that f0 and f1 are the same function except the
arguments are in a different order.  Then f1 (or f0) calls the other function
with the corrected order (with a sibcalling but marked as almost alias).

At the target level, we see the almost alias had the same argument passing
rules and just create them as an alias.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]