|
From: Ivo R. <ir...@so...> - 2017-09-16 20:23:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e2b59435e443ef4a786c31d320a3c1c0e1ff40d0 commit e2b59435e443ef4a786c31d320a3c1c0e1ff40d0 Author: Ivo Raisr <iv...@iv...> Date: Sat Sep 16 22:22:53 2017 +0200 Cherry pick b9df4c8dec4d3154257818eb81111df43f2a7bf2 from master. Fix a typo bug in VEX register allocator v3. Also scanning a few more instructions ahead helps producing better code. Diff: --- VEX/priv/host_generic_reg_alloc3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VEX/priv/host_generic_reg_alloc3.c b/VEX/priv/host_generic_reg_alloc3.c index ef8f583..7e1e609 100644 --- a/VEX/priv/host_generic_reg_alloc3.c +++ b/VEX/priv/host_generic_reg_alloc3.c @@ -509,7 +509,7 @@ static inline HReg find_vreg_to_spill( - reg_usage[scan_forward_end], where scan_forward_end = MIN(scan_forward_max, scan_forward_start + FEW_INSTRUCTIONS). reg_usage uses chunk instruction numbering. */ -# define FEW_INSTRUCTIONS 5 +# define FEW_INSTRUCTIONS 20 Short scan_forward_end = (scan_forward_max <= scan_forward_start + FEW_INSTRUCTIONS) ? scan_forward_max : scan_forward_start + FEW_INSTRUCTIONS; @@ -532,10 +532,10 @@ static inline HReg find_vreg_to_spill( } } - if (ii_chunk - scan_forward_start > distance_so_far) { - distance_so_far = ii_chunk - scan_forward_start; + if (ii_chunk >= distance_so_far) { + distance_so_far = ii_chunk; vreg_found = vreg; - if (ii_chunk + distance_so_far == scan_forward_end) { + if (distance_so_far == scan_forward_end) { break; /* We are at the end. Nothing could be better. */ } } |