Bug 5563 – Failed/succeeded inlining listing

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-02-11T03:25:00Z
Last change time
2017-07-02T02:07:37Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-02-11T03:25:22Z
Inlining is one of the most important performance optimizations, so an useful information for the programmer is a list of failed/succeeded inlining points. See: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=129206 Taking a look at the produced asm is often enough to see where inlining has happened or not, but a list shown by the compiler is simpler and quicker to read and understand, for external automatic tools too. When you compile CommonLisp with max optimization levels the compiler gives many comments that explain why it isn't optimizing something, including some forms of inlining, see for example: http://shootout.alioth.debian.org/u32/program.php?test=fasta&lang=sbcl&id=3 Example of the comments: ; file: /home/dunham/shootout/bench/fasta/fasta.sbcl-3.sbcl ; in: DEFUN CUMSUM ; (CEILING (* +IM+ (INCF C X))) ; --> CEILING MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL TRUNCATE LET ; ==> ; (SB-KERNEL:%UNARY-TRUNCATE/SINGLE-FLOAT SB-C::X) ; ; note: forced to do full call ; unable to do inline float truncate (cost 5) because: ; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES ; (SIGNED-BYTE 32) &REST ; T). ; unable to do inline float truncate (cost 5) because: ; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES ; (UNSIGNED-BYTE 32) ; &REST T). ; --> CEILING MULTIPLE-VALUE-BIND MULTIPLE-VALUE-CALL TRUNCATE LET VALUES - ; ==> ; (SB-KERNEL:%SINGLE-FLOAT SB-C::RES) ; ; note: forced to do full call ; unable to do inline float coercion (cost 5) because: ; The first argument is a INTEGER, not a (SIGNED-BYTE 32). ; unable to do inline float coercion (cost 6) because: ; The first argument is a INTEGER, not a (UNSIGNED-BYTE 32). ... Another similar kind of useful notes from the compiler: http://d.puremagic.com/issues/show_bug.cgi?id=5070
Comment #1 by dlang-bugzilla — 2017-07-02T02:07:37Z
We now have pragma(inline, true) which should satisfy this general use case.