* Corrected calculation of spilling efficiency.

This commit is contained in:
Yuriy Sydorov 2021-11-01 12:19:45 +02:00
parent c9d9d42f0e
commit c4a1cdceae

View File

@ -3013,7 +3013,7 @@ unit rgobj;
Higher value is better. Higher value is better.
} }
var var
i,spillingcounter,max_weight:longint; i,j,spillingcounter,max_weight:longint;
all_weight,spill_weight,d: double; all_weight,spill_weight,d: double;
begin begin
max_weight:=1; max_weight:=1;
@ -3027,17 +3027,22 @@ unit rgobj;
all_weight:=0; all_weight:=0;
for i:=first_imaginary to maxreg-1 do for i:=first_imaginary to maxreg-1 do
with reginfo[i] do with reginfo[i] do
begin if not (ri_spill_helper in flags) then
d:=weight/max_weight; begin
all_weight:=all_weight+d; d:=weight/max_weight;
if (weight>100) and all_weight:=all_weight+d;
(i<=high(spillinfo)) and if (ri_coalesced in flags) and (alias>=first_imaginary) then
spillinfo[i].spilled then j:=alias
begin else
inc(spillingcounter); j:=i;
spill_weight:=spill_weight+d; if (reginfo[j].weight>100) and
end; (j<=high(spillinfo)) and
end; spillinfo[j].spilled then
begin
inc(spillingcounter);
spill_weight:=spill_weight+d;
end;
end;
if spillingcounter>0 then if spillingcounter>0 then
begin begin
d:=(1.0-spill_weight/all_weight)*100.0; d:=(1.0-spill_weight/all_weight)*100.0;