shithub: mc

Download patch

ref: fb881a4e58df2e5cd0ec824024e63db0811f5dcc
parent: f139158ef2c78c2aef7afda69b697e50619f8a51
author: Ori Bernstein <[email protected]>
date: Tue Sep 9 21:49:02 EDT 2014

Fix register allocator bug.

    We weren't merging all defs correctly. Shit.

--- a/6/ra.c
+++ b/6/ra.c
@@ -1040,8 +1040,8 @@
         /* if we already have remapped a use for this register, we want to
          * store the same register from the def. */
         found = 0;
-        for (j = 0; j < defidx; j++) {
-            for (k = 0; i < useidx; k++) {
+        for (j = 0; j <= defidx; j++) {
+            for (k = 0; k < useidx; k++) {
                 if (use[k].oldreg == d[j]) {
                     def[defidx].newreg = use[j].newreg;
                     bsput(s->neverspill, def[defidx].newreg->reg.id);