[Mono-bugs] [Bug 60673][Wis] New - -O=loop sometimes adds padding in wrong places
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Jun 2004 21:29:32 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=60673
--- shadow/60673 2004-06-23 21:29:32.000000000 -0400
+++ shadow/60673.tmp.20018 2004-06-23 21:29:32.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 60673
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: bmaurer@users.sf.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: -O=loop sometimes adds padding in wrong places
+
+Consider this code:
+
+using System;
+class T {
+ static void Main () {
+ int i = Environment.TickCount;
+ new T ().X ();
+ Console.WriteLine (Environment.TickCount - i);
+ }
+
+ void X () {
+ int i = 0;
+ while (
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000 &&
+ i < 50000000) i ++;
+ }
+}
+
+We generate assembly like:
+
+ 11: 81 ff 80 f0 fa 02 cmp edi,0x2faf080
+ 17: 0f 8d 27 01 00 00 jge 144 <T_X+0x144>
+ 1d: 8d 6d 00 lea ebp,[ebp]
+ 20: 81 ff 80 f0 fa 02 cmp edi,0x2faf080
+ 26: 0f 8d 18 01 00 00 jge 144 <T_X+0x144>
+ 2c: 8d 64 24 00 lea esp,[esp]
+ 30: 81 ff 80 f0 fa 02 cmp edi,0x2faf080
+
+the lea instructions are padding, which are trying to align loops. However,
+ alignment should not be added.