www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9167] New: A failed inlining of inner function

http://d.puremagic.com/issues/show_bug.cgi?id=9167

           Summary: A failed inlining of inner function
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



void main() {
    int x;
    int foo() {
        return x;
    }
    int bar() {
        return foo();
    }
}



DMD 2.061alpha (with -O -release -inline -noboundscheck) gives this asm,
showing foo() is not inlined in bar():

main.foo:
        push EAX
        mov EAX, [EAX]
        pop ECX
        ret

main.bar:
        push EAX
        call near ptr _D4test4mainFZv3fooMFZi
        pop ECX
        ret

main:
        push EAX
        xor EAX, EAX
        mov [ESP], EAX
        pop ECX
        ret

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 16 2012