* in case of "movzbl %dl,%edx" etc, %edx depends on its previous value.

regloadedwithnewvalue() gave the wrong answer for this in case
    candependonprevvalue was false (caused a wrong optimization in the
    space() function of the rtl)

git-svn-id: trunk@8808 -
This commit is contained in:
Jonas Maebe 2007-10-14 20:22:23 +00:00
parent cfa6d83aee
commit c03f19fa50
3 changed files with 28 additions and 4 deletions

1
.gitattributes vendored
View File

@ -6839,6 +6839,7 @@ tests/test/opt/treg2.pp svneol=native#text/plain
tests/test/opt/treg3.pp svneol=native#text/plain
tests/test/opt/treg4.pp svneol=native#text/plain
tests/test/opt/tretopt.pp svneol=native#text/plain
tests/test/opt/tspace.pp svneol=native#text/plain
tests/test/t4cc1.pp svneol=native#text/plain
tests/test/t4cc2.pp svneol=native#text/plain
tests/test/tabstrcl.pp svneol=native#text/plain

View File

@ -1124,10 +1124,13 @@ begin
(p.oper[1]^.typ = top_reg) and
(getsupreg(p.oper[1]^.reg) = supreg) and
(canDependOnPrevValue or
(p.oper[0]^.typ <> top_ref) or
not regInRef(supreg,p.oper[0]^.ref^)) or
((p.opcode = A_POP) and
(getsupreg(p.oper[0]^.reg) = supreg)));
(p.oper[0]^.typ = top_const) or
((p.oper[0]^.typ = top_reg) and
(getsupreg(p.oper[0]^.reg) <> supreg)) or
((p.oper[0]^.typ = top_ref) and
not regInRef(supreg,p.oper[0]^.ref^)))) or
((p.opcode = A_POP) and
(getsupreg(p.oper[0]^.reg) = supreg));
end;
procedure UpdateUsedRegs(var UsedRegs: TRegSet; p: tai);

20
tests/test/opt/tspace.pp Normal file
View File

@ -0,0 +1,20 @@
{ %opt=-O2 }
function space (b : byte): shortstring;
begin
space[0] := chr(b);
FillChar (Space[1],b,' ');
end;
var
s: string;
i: longint;
begin
fillchar(s,sizeof(s),255);
s:=space(255);
if length(s)<>255 then
halt(1);
for i:=1 to 255 do
if s[i]<>' ' then
halt(2);
end.