diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-11-06 16:36:02 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-11-06 16:36:02 +0000 |
commit | 53f06f019a8efd8c8d99a60213d147e799e4e71f (patch) | |
tree | 06f7347b4378266dcd0c88a51a9f691f7ed12ec2 /compiler/nld.pas | |
parent | 8c200851155e625a9af1e1773354eaaf482f66ed (diff) | |
download | fpc-53f06f019a8efd8c8d99a60213d147e799e4e71f.tar.gz |
+ more restrictions on pred/succ to dec/inc optimization
o check if the argument can be used as a call by reference parameter
o check if the argument has no side-effects
+ tests
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@34816 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/nld.pas')
-rw-r--r-- | compiler/nld.pas | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/nld.pas b/compiler/nld.pas index 729b7f996d..24d6cd9b88 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -569,8 +569,9 @@ implementation ((tinlinenode(right).inlinenumber=in_succ_x) or (tinlinenode(right).inlinenumber=in_pred_x)) and (tinlinenode(right).left.isequal(left)) and ((localswitches*[cs_check_overflow,cs_check_range])=[]) and - ((right.localswitches*[cs_check_overflow,cs_check_range])=[]) - then + ((right.localswitches*[cs_check_overflow,cs_check_range])=[]) and + valid_for_var(tinlinenode(right).left,false) and + not(might_have_sideeffects(tinlinenode(right).left)) then begin if tinlinenode(right).inlinenumber=in_succ_x then result:=cinlinenode.create( |