]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix a typo bug in VEX register allocator v3.
authorIvo Raisr <ivosh@ivosh.net>
Sat, 16 Sep 2017 16:48:36 +0000 (18:48 +0200)
committerIvo Raisr <ivosh@ivosh.net>
Sat, 16 Sep 2017 16:49:56 +0000 (18:49 +0200)
Also scanning a few more instructions ahead helps producing
better code.

VEX/priv/host_generic_reg_alloc3.c

index 8ee4e482b846a518569c74a56973a1462dfd880d..5b2a9f2fa097e0d45d1e51a04a0ee7e76524b5d8 100644 (file)
@@ -323,7 +323,7 @@ static inline HReg find_vreg_to_spill(
       - reg_usage[scan_forward_from]
       - reg_usage[scan_forward_end], where scan_forward_end
            = MIN(scan_forward_max, scan_forward_from + FEW_INSTRUCTIONS). */
-#  define FEW_INSTRUCTIONS 5
+#  define FEW_INSTRUCTIONS 20
    UInt scan_forward_end
       = (scan_forward_max <= scan_forward_from + FEW_INSTRUCTIONS) ?
         scan_forward_max : scan_forward_from + FEW_INSTRUCTIONS;
@@ -344,10 +344,10 @@ static inline HReg find_vreg_to_spill(
                }
             }
 
-            if (ii - scan_forward_from > distance_so_far) {
-               distance_so_far = ii = scan_forward_from;
+            if (ii >= distance_so_far) {
+               distance_so_far = ii;
                vreg_found = vreg;
-               if (ii + distance_so_far == scan_forward_end) {
+               if (distance_so_far == scan_forward_end) {
                   break; /* We are at the end. Nothing could be better. */
                }
             }