mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 19:23:43 +02:00
* 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:
parent
cfa6d83aee
commit
c03f19fa50
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
20
tests/test/opt/tspace.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user