This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/73285] perhaps avoid duplication for function of argument order (double, int) or (int, double)
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 12 Aug 2016 00:03:31 +0000
- Subject: [Bug tree-optimization/73285] perhaps avoid duplication for function of argument order (double, int) or (int, double)
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
- References: <bug-73285-4@http.gcc.gnu.org/bugzilla/>
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.