becopyilp: fix search for aligned free color
authorMatthias Braun <matze@braunis.de>
Thu, 26 Jan 2012 17:37:05 +0000 (18:37 +0100)
committerMatthias Braun <matthias.braun@kit.edu>
Thu, 1 Mar 2012 15:02:01 +0000 (16:02 +0100)
ir/be/becopyilp.c

index 3e34848..b03ed5a 100644 (file)
@@ -206,11 +206,15 @@ void sr_reinsert(size_red_t *sr)
 
                /* now all bits not set are possible colors */
                /* take one that matches the alignment constraint */
-               do {
-                       free_col = (unsigned)rbitset_next(possible_cols, 0, true);
-               } while ((free_col % arch_get_irn_register_req(irn)->width) != 0
-                                && free_col != n_regs - 1);
+               free_col = 0;
                assert(!rbitset_is_empty(possible_cols, n_regs) && "No free color found. This can not be.");
+               while (true) {
+                       free_col = (unsigned)rbitset_next(possible_cols, free_col, true);
+                       if (free_col % arch_get_irn_register_req(irn)->width == 0)
+                               break;
+                       ++free_col;
+                       assert(free_col < n_regs);
+               }
                set_irn_col(sr->co->cls, irn, free_col);
                pset_remove_ptr(sr->all_removed, irn); /* irn is back in graph again */
        }