mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 12:09:18 +02:00
Merged revisions 1317 via svnmerge from
/trunk git-svn-id: branches/fixes_2_0@1318 -
This commit is contained in:
parent
e3017bf0bb
commit
dafd53e4ff
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6043,6 +6043,7 @@ tests/webtbs/tw4240.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4247.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4253.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4260.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4266.pp -text
|
||||
tests/webtbs/tw4272.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4277.pp svneol=native#text/plain
|
||||
tests/webtbs/tw4294.pp svneol=native#text/plain
|
||||
|
@ -409,7 +409,7 @@ var
|
||||
|
||||
var
|
||||
prevreginfo: toptreginfo;
|
||||
hp2, hp3{, EndMod},highPrev, orgPrev: tai;
|
||||
hp2, hp3{, EndMod},highPrev, orgPrev, pprev: tai;
|
||||
{Cnt,} OldNrofMods: Longint;
|
||||
startRegInfo, OrgRegInfo, HighRegInfo: toptreginfo;
|
||||
regModified, lastregloadremoved: array[RS_EAX..RS_ESP] of boolean;
|
||||
@ -439,6 +439,7 @@ begin {CheckSequence}
|
||||
regsNotRead := [RS_EAX,RS_EBX,RS_ECX,RS_EDX,RS_ESP,RS_EBP,RS_EDI,RS_ESI];
|
||||
regsStillValid := regsNotRead;
|
||||
GetLastInstruction(p, prev);
|
||||
pprev := prev;
|
||||
tmpreg:=RS_INVALID;
|
||||
regCounter := getNextRegToTest(prev,tmpreg);
|
||||
while (regcounter <> RS_INVALID) do
|
||||
@ -519,17 +520,45 @@ begin {CheckSequence}
|
||||
if not flagResultsNeeded then
|
||||
flagResultsNeeded := ptaiprop(hp3.optinfo)^.FlagsUsed;
|
||||
inc(Found);
|
||||
if not GetNextInstruction(hp2, hp2) or
|
||||
not GetNextInstruction(hp3, hp3) then
|
||||
break;
|
||||
if (Found <> OldNrofMods) then
|
||||
if not GetNextInstruction(hp2, hp2) or
|
||||
not GetNextInstruction(hp3, hp3) then
|
||||
break;
|
||||
end;
|
||||
|
||||
getnextinstruction(hp3,hp3);
|
||||
{
|
||||
a) movl -4(%ebp),%edx
|
||||
movl -12(%ebp),%ecx
|
||||
...
|
||||
movl -8(%ebp),%eax
|
||||
movl -12(%ebp),%edx (marked as removable)
|
||||
movl (%eax,%edx),%eax (replaced by "movl (%eax,%ecx),%eax")
|
||||
...
|
||||
movl -8(%ebp),%eax
|
||||
movl -12(%ebp),%edx
|
||||
movl (%eax,%edx),%eax
|
||||
movl (%edx),%edx
|
||||
|
||||
-> the "movl -12(ebp),%edx" can't be removed in the last sequence, because
|
||||
edx has not been replaced with ecx there, and edx is still used after the
|
||||
sequence
|
||||
|
||||
b) tests/webtbs/tw4266.pp
|
||||
}
|
||||
|
||||
for regCounter2 := RS_EAX to RS_EDI do
|
||||
if (reginfo.new2OldReg[regCounter2] <> RS_INVALID) and
|
||||
(regCounter2 in ptaiprop(hp3.optinfo)^.usedRegs) and
|
||||
not regLoadedWithNewValue(regCounter2,false,hp3) and
|
||||
lastregloadremoved[regcounter2] then
|
||||
found := 0;
|
||||
{ case a) above }
|
||||
((not regLoadedWithNewValue(regCounter2,false,hp3) and
|
||||
lastregloadremoved[regcounter2]) or
|
||||
{ case b) above }
|
||||
((ptaiprop(pprev.optinfo)^.regs[regcounter2].wstate <>
|
||||
ptaiprop(hp2.optinfo)^.regs[regcounter2].wstate))) then
|
||||
begin
|
||||
found := 0;
|
||||
end;
|
||||
|
||||
if checkingPrevSequences then
|
||||
begin
|
||||
|
30
tests/webtbs/tw4266.pp
Normal file
30
tests/webtbs/tw4266.pp
Normal file
@ -0,0 +1,30 @@
|
||||
{ %OPT=-O-G2p3 -Sd}
|
||||
|
||||
var
|
||||
c: array[1..10] of integer;
|
||||
b, a: array[1..10, 1..10] of integer;
|
||||
|
||||
procedure rec(k: integer);
|
||||
var i: integer;
|
||||
begin
|
||||
for i := 1 to c[k] do
|
||||
if a[k, b[k, i]] = 0 then
|
||||
begin
|
||||
//writeln(i, ' ', k);
|
||||
a[k, b[k, i]]:= 1;
|
||||
a[b[k, i], k]:= 1;
|
||||
rec(b[k, i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
fillchar(a, sizeof(a), 0);
|
||||
c[1] := 2;
|
||||
c[2] := 2;
|
||||
c[3] := 2;
|
||||
b[1, 1] := 2; b[1, 2] := 3;
|
||||
b[2, 1] := 1; b[2, 2] := 3;
|
||||
b[3, 1] := 1; b[3, 2] := 2;
|
||||
rec(1);
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user