Merged revisions 1317 via svnmerge from

/trunk

git-svn-id: branches/fixes_2_0@1318 -
This commit is contained in:
Jonas Maebe 2005-10-07 16:52:09 +00:00
parent e3017bf0bb
commit dafd53e4ff
3 changed files with 67 additions and 7 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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.