* do +/-/pred/succ to inc/dec optimizations only at an appropriate optimziation level

git-svn-id: trunk@35569 -
This commit is contained in:
florian 2017-03-12 07:49:37 +00:00
parent a7c7319352
commit b55cb246da

View File

@ -566,6 +566,8 @@ implementation
not equal_defs(right.resultdef,left.resultdef) then
inserttypeconv(right,left.resultdef);
if cs_opt_level2 in current_settings.optimizerswitches then
begin
{ replace i:=succ/pred(i) by inc/dec(i)? }
if (right.nodetype=inlinen) and
((tinlinenode(right).inlinenumber=in_succ_x) or (tinlinenode(right).inlinenumber=in_pred_x)) and
@ -585,6 +587,8 @@ implementation
left:=nil;
exit;
end;
if cs_opt_level3 in current_settings.optimizerswitches then
begin
{ replace i:=i+k/i:=i-k by inc/dec(i,k)? }
if (right.nodetype in [addn,subn]) and
(taddnode(right).left.isequal(left)) and
@ -624,6 +628,8 @@ implementation
exit;
end;
end;
end;
end;
function tassignmentnode.pass_typecheck:tnode;