[Issue 10985] Compiler doesn't attempt to inline non-templated functions from libraries (even having the full source)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Sep 8 13:33:33 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10985
Dmitry Olshansky <dmitry.olsh at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Inliner doesn't attempt to |Compiler doesn't attempt to
|inline non-templated |inline non-templated
|functions from libraries |functions from libraries
|(even having the full |(even having the full
|source) |source)
--- Comment #5 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-09-08 13:33:31 PDT ---
(In reply to comment #4)
> Neither GDC nor LDC rely on the frontend inliner. To make sure the code is or
> isn't inlined properly, you really need to check the resulting generated code.
Well for me full callgraph is as good evidence as any. Anyhow 2 disassmebled
mains for LDC are below.
The problem is like I said lies deeper - it isn't DMD's _inliner_ fault, rather
that the availaible code is not passed to it. Hence the absense of functions in
DMDs inline scan, they are *not presented* to it at all. Ditto with other
compilers.
With libmylib.a passed on the command line:
_Dmain:
sub RSP,068h
lea RDI,050h[RSP]
lea RAX,030h[RSP]
mov qword ptr 040h[RSP],offset FLAT:.str at 32S
mov qword ptr 038h[RSP],5
mov ECX,038h[RSP]
mov 028h[RSP],ECX
mov 030h[RSP],ECX
mov 020h[RSP],RDI
mov RDI,RAX
mov 018h[RSP],RAX
call _D5mylib7MyStuff4fuzzMFZi at PC32
mov RDI,018h[RSP]
mov 014h[RSP],EAX
call _D5mylib7MyStuff4buzzMFZi at PC32
mov qword ptr 060h[RSP],offset FLAT:.str1 at 32S
mov qword ptr 058h[RSP],5
mov RDI,058h[RSP]
mov ECX,EDI
mov 048h[RSP],ECX
mov ECX,048h[RSP]
mov 050h[RSP],ECX
mov RDI,020h[RSP]
mov 010h[RSP],EAX
call _D5mylib7MyStuff4fuzzMFZi at PC32
lea RDI,050h[RSP]
mov 0Ch[RSP],EAX
call _D5mylib7MyStuff4buzzMFZi at PC32
mov EDI,038h
mov 8[RSP],EAX
call _D5mylib12nonTemplatedFiZi at PC32
mov ECX,0
mov 4[RSP],EAX
mov EAX,ECX
add RSP,068h
ret
With mylib.d passed on the command line:
_Dmain:
mov EAX,0
mov qword ptr -038h[RSP],offset FLAT:.str at 32S
mov qword ptr -040h[RSP],5
mov ECX,-040h[RSP]
mov -050h[RSP],ECX
mov -048h[RSP],ECX
mov qword ptr -8[RSP],offset FLAT:.str1 at 32S
mov qword ptr -010h[RSP],5
mov RDX,-010h[RSP]
mov ECX,EDX
mov -020h[RSP],ECX
mov ECX,-020h[RSP]
mov -018h[RSP],ECX
mov dword ptr -024h[RSP],038h
mov ECX,-024h[RSP]
mov -030h[RSP],ECX
mov ECX,-030h[RSP]
mov -028h[RSP],ECX
ret
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list