digitalmars.D.bugs - [Issue 1149] New: Optimizer: obsolete array length loads, common subexpr. elimin. not working
- d-bugmail puremagic.com Apr 15 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1149 Summary: Optimizer: obsolete array length loads, common subexpr. elimin. not working Product: D Version: 1.012 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: jascha mainia.de consider the following code: void main() { uint[] arr; arr.length = 4; arr[0] = 1; arr[1] = 1; arr[2] = 1; arr[3] = 1; } for the 4 assignments, "dmd -O -inline" generates mov ECX,1 mov EDX,010h[ESP] mov EAX,0Ch[ESP] mov [EDX],ECX mov EDX,010h[ESP] mov EAX,0Ch[ESP] mov 4[EDX],ECX mov EDX,010h[ESP] mov EAX,0Ch[ESP] mov 8[EDX],ECX mov EDX,010h[ESP] mov EAX,0Ch[ESP] mov 0Ch[EDX],ECX instead of mov ECX,1 mov EDX,010h[ESP] mov [EDX],ECX mov 4[EDX],ECX mov 8[EDX],ECX mov 0Ch[EDX],ECX - the length of the array is always loaded, even if it's not used - the array pointer is loaded multiple times into the same register the common subexpression elimination appears to be working for the value in ECX, but not for the pointer in EDX. --
Apr 15 2007








d-bugmail puremagic.com