This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Question about patch for PR bootstrap/65150 (identical functions)
- From: "Steve Ellcey " <sellcey at imgtec dot com>
- To: <mliska at suse dot cz>, <hubicka at ucw dot cz>, <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 May 2015 10:50:00 -0700
- Subject: Question about patch for PR bootstrap/65150 (identical functions)
- Authentication-results: sourceware.org; auth=none
Jan and Martin,
I just noticed that your patch for PR bootstrap/65150 broke one of the
MIPS tests (gcc.target/mips/branch-1.c). I can fix the test with no
problem but I am wondering if the change I am seeing with your patch
is intended or not.
A cutdown version of the test is:
void bar (void);
void f1 (int x) { if (x & 4) bar (); }
void f2 (int x) { if ((x >> 2) & 1) bar (); }
After your change GCC sees that the code for f1 and f2 are identical
so it replaced the body of f2 with a call to f1. This optimization will
save space but it is not going to be faster because any call to f2 will
now include an extra call/return. Do other platforms have this same issue
or is there a way to make f2 an alias for f1 on other targets so no extra
call is needed? I looked around to see if there was a target function or
macro that is used to make one function an alias of another but I didn't
see anything.
Steve Ellcey
sellcey@imgtec.com