mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:29:19 +02:00
* do for-loop unrolling after for-loop simplification, resolves #36589
git-svn-id: trunk@43999 -
This commit is contained in:
parent
2b658ef11c
commit
069e040e49
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -17956,6 +17956,7 @@ tests/webtbs/tw3650.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3653.pp svneol=native#text/plain
|
||||
tests/webtbs/tw36544a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw36544b.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw36589.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3661.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3666.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3669.pp svneol=native#text/plain
|
||||
|
@ -1690,8 +1690,26 @@ implementation
|
||||
|
||||
set_varstate(left,vs_written,[]);
|
||||
|
||||
{ Make sure that the loop var and the
|
||||
from and to values are compatible types }
|
||||
if not(m_iso in current_settings.modeswitches) then
|
||||
rangedef:=left.resultdef
|
||||
else
|
||||
rangedef:=get_iso_range_type(left.resultdef);
|
||||
|
||||
check_ranges(right.fileinfo,right,rangedef);
|
||||
inserttypeconv(right,rangedef);
|
||||
|
||||
check_ranges(t1.fileinfo,t1,rangedef);
|
||||
inserttypeconv(t1,rangedef);
|
||||
|
||||
if assigned(t2) then
|
||||
typecheckpass(t2);
|
||||
result:=simplify(false);
|
||||
|
||||
{ loop unrolling }
|
||||
if (cs_opt_loopunroll in current_settings.optimizerswitches) and
|
||||
if not(assigned(result)) and
|
||||
(cs_opt_loopunroll in current_settings.optimizerswitches) and
|
||||
assigned(t2) and
|
||||
{ statements must be error free }
|
||||
not(nf_error in t2.flags) then
|
||||
@ -1709,22 +1727,6 @@ implementation
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Make sure that the loop var and the
|
||||
from and to values are compatible types }
|
||||
if not(m_iso in current_settings.modeswitches) then
|
||||
rangedef:=left.resultdef
|
||||
else
|
||||
rangedef:=get_iso_range_type(left.resultdef);
|
||||
|
||||
check_ranges(right.fileinfo,right,rangedef);
|
||||
inserttypeconv(right,rangedef);
|
||||
|
||||
check_ranges(t1.fileinfo,t1,rangedef);
|
||||
inserttypeconv(t1,rangedef);
|
||||
|
||||
if assigned(t2) then
|
||||
typecheckpass(t2);
|
||||
result:=simplify(false);
|
||||
end;
|
||||
|
||||
|
||||
|
6
tests/webtbs/tw36589.pp
Normal file
6
tests/webtbs/tw36589.pp
Normal file
@ -0,0 +1,6 @@
|
||||
var k : longint;
|
||||
begin
|
||||
for k:=1 downto 10 do
|
||||
begin
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user