mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 07:47:59 +02:00
* setup proper starting value when optimizing away a loop, resolves #9096
git-svn-id: trunk@8443 -
This commit is contained in:
parent
d304408a1b
commit
1b7aeb568c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8392,6 +8392,7 @@ tests/webtbs/tw9073.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9076.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9076a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9085.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9096.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9098.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9107.pp svneol=native#text/plain
|
||||
tests/webtbs/tw9108.pp svneol=native#text/plain
|
||||
|
@ -36,7 +36,7 @@ unit optunrol;
|
||||
globtype,globals,constexp,
|
||||
cpuinfo,
|
||||
nutils,
|
||||
nbas,nflw,ncon,ninl,ncal;
|
||||
nbas,nflw,ncon,ninl,ncal,nld;
|
||||
|
||||
var
|
||||
nodecount : aword;
|
||||
@ -76,7 +76,7 @@ unit optunrol;
|
||||
var
|
||||
unrolls,i : cardinal;
|
||||
counts : qword;
|
||||
unrollstatement : tstatementnode;
|
||||
unrollstatement,newforstatement : tstatementnode;
|
||||
unrollblock : tblocknode;
|
||||
begin
|
||||
result:=nil;
|
||||
@ -126,7 +126,14 @@ unit optunrol;
|
||||
end;
|
||||
{ can we get rid of the for statement? }
|
||||
if unrolls=counts then
|
||||
result:=unrollblock;
|
||||
begin
|
||||
{ create block statement }
|
||||
result:=internalstatements(newforstatement);
|
||||
{ initial assignment }
|
||||
addstatement(newforstatement,cassignmentnode.create(
|
||||
tfornode(node).left.getcopy,tfornode(node).right.getcopy));
|
||||
addstatement(newforstatement,unrollblock);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
12
tests/webtbs/tw9096.pp
Normal file
12
tests/webtbs/tw9096.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{ %OPT=-Ooloopunroll }
|
||||
var
|
||||
arr : array[0..0,0..0] of longint;
|
||||
i : longint;
|
||||
|
||||
begin
|
||||
i:=1234;
|
||||
for i := 0 to 0 do
|
||||
if i<>0 then
|
||||
halt(1);
|
||||
writeln('ok');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user