[LLVMbugs] [Bug 5234] llvm-gcc doesn't honor -fno-inline?

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Oct 19 14:01:37 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5234


Daniel Dunbar <daniel at zuster.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




--- Comment #4 from Daniel Dunbar <daniel at zuster.org>  2009-10-19 16:01:37 ---
I'm not convinced. Based on the full description -fno-inline sounds much more
appropriate:
--
 -fno-inline
... Normally this option is used to keep the compiler from expanding ***any***
(emphasis mine) functions inline.
--

 In addition, -fno-inline does seem to stop at least some inlining with gcc. I
have no idea what gcc is actually doing, of course.
--
ddunbar at giles:size$ cat t.c
static int f0() { return 1; }
int f1() { return f0(); }
ddunbar at giles:size$ gcc -O3 -m32 -S -o - t.c
        .text
        .align 4,0x90
.globl _f1
_f1:
        pushl   %ebp
        movl    %esp, %ebp
        movl    $1, %eax
        leave
        ret
        .subsections_via_symbols
ddunbar at giles:size$ gcc -fno-inline -O3 -m32 -S -o - t.c
        .text
        .align 4,0x90
_f0:
        pushl   %ebp
        movl    %esp, %ebp
        movl    $1, %eax
        leave
        ret
        .align 4,0x90
.globl _f1
_f1:
        pushl   %ebp
        movl    %esp, %ebp
        leave
        jmp     _f0
        .subsections_via_symbols
ddunbar at giles:size$ 
--

I attached the real example (a clang file, on Darwin x86_64) that I was looking
at when I noticed this. -fno-inline-functions doesn't look like the right flag
at all.
--
ddunbar at giles:size$ gcc -arch x86_64 -O3 -S -o - orig.ii | wc -c
 1260250
ddunbar at giles:size$ gcc -fno-inline -arch x86_64 -O3 -S -o - orig.ii | wc -c
 2360776
ddunbar at giles:size$ gcc -fno-inline-functions -arch x86_64 -O3 -S -o - orig.ii
| wc -c
 1255753
ddunbar at giles:size$ /Developer/usr/bin/llvm-gcc -arch x86_64 -O3 -S -o -
orig.ii | wc -c
 1228860
ddunbar at giles:size$ /Developer/usr/bin/llvm-gcc -fno-inline -arch x86_64 -O3 -S
-o - orig.ii | wc -c
 1228860
ddunbar at giles:size$ /Developer/usr/bin/llvm-gcc -fno-inline-functions -arch
x86_64 -O3 -S -o - orig.ii | wc -c
 2878334
--
llvm-gcc seems more like it has the behavior of -fno-inline and
-fno-inline-functions reversed, at least from a user perspective.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list