← Back to index
|
Original Bugzilla link
Bug 8615 – Unused lazy arguments generate redundant code in empty inlined functions
Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2012-09-03T13:32:12Z
Last change time
2020-03-21T03:56:40Z
Assigned to
No Owner
Creator
Peter Alexander
Comments
Comment #0
by peter.alexander.au — 2012-09-03T13:32:12Z
% cat test.d void foo(lazy ulong x) {} void main(string[] args) { foo(args.length); } admin@poita ~% dmd -inline -O -release test.d admin@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
Comment #1
by b2.temp — 2020-02-20T15:01:44Z
fixed see,
https://godbolt.org/z/3P_PtD