[Issue 8615] New: Unused lazy arguments generate redundant code in	empty inlined functions
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Sep  3 13:31:37 PDT 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=8615
           Summary: Unused lazy arguments generate redundant code in empty
                    inlined functions
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: peter.alexander.au at gmail.com
--- Comment #0 from Peter Alexander <peter.alexander.au at gmail.com> 2012-09-03 13:32:12 PDT ---
% cat test.d
void foo(lazy ulong x) {}
void main(string[] args)
{
    foo(args.length);
}
admin at poita ~% dmd -inline -O -release test.d
admin at poita ~% otool -tV test | grep __Dmain: -A 9
__Dmain:
0000000100000dac    pushq    %rbp
0000000100000dad    movq    %rsp,%rbp
0000000100000db0    subq    $0x10,%rsp
0000000100000db4    movq    %rdi,0xf0(%rbp)
0000000100000db8    movq    %rsi,0xf8(%rbp)
0000000100000dbc    xorl    %eax,%eax
0000000100000dbe    movq    %rbp,%rsp
0000000100000dc1    popq    %rbp
0000000100000dc2    ret
Notice the redundant movq's. They aren't there when the parameter isn't lazy.
Ideally, this empty function would have no effect on the generated code.
Tested using DMD 2.060
-- 
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