mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 03:09:08 +02:00
* do +/-/pred/succ to inc/dec optimizations only at an appropriate optimziation level
git-svn-id: trunk@35569 -
This commit is contained in:
parent
a7c7319352
commit
b55cb246da
@ -566,6 +566,8 @@ implementation
|
|||||||
not equal_defs(right.resultdef,left.resultdef) then
|
not equal_defs(right.resultdef,left.resultdef) then
|
||||||
inserttypeconv(right,left.resultdef);
|
inserttypeconv(right,left.resultdef);
|
||||||
|
|
||||||
|
if cs_opt_level2 in current_settings.optimizerswitches then
|
||||||
|
begin
|
||||||
{ replace i:=succ/pred(i) by inc/dec(i)? }
|
{ replace i:=succ/pred(i) by inc/dec(i)? }
|
||||||
if (right.nodetype=inlinen) and
|
if (right.nodetype=inlinen) and
|
||||||
((tinlinenode(right).inlinenumber=in_succ_x) or (tinlinenode(right).inlinenumber=in_pred_x)) and
|
((tinlinenode(right).inlinenumber=in_succ_x) or (tinlinenode(right).inlinenumber=in_pred_x)) and
|
||||||
@ -585,6 +587,8 @@ implementation
|
|||||||
left:=nil;
|
left:=nil;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if cs_opt_level3 in current_settings.optimizerswitches then
|
||||||
|
begin
|
||||||
{ replace i:=i+k/i:=i-k by inc/dec(i,k)? }
|
{ replace i:=i+k/i:=i-k by inc/dec(i,k)? }
|
||||||
if (right.nodetype in [addn,subn]) and
|
if (right.nodetype in [addn,subn]) and
|
||||||
(taddnode(right).left.isequal(left)) and
|
(taddnode(right).left.isequal(left)) and
|
||||||
@ -624,6 +628,8 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tassignmentnode.pass_typecheck:tnode;
|
function tassignmentnode.pass_typecheck:tnode;
|
||||||
|
Loading…
Reference in New Issue
Block a user