|
@@ -1607,7 +1607,8 @@ implementation
|
|
|
|
|
|
}
|
|
|
if (cs_opt_level2 in current_settings.optimizerswitches) and
|
|
|
- (left.nodetype in [gtn,gten,ltn,lten]) and IsSingleStatement(right,thenstmnt) and ((t1=nil) or IsSingleStatement(t1,elsestmnt)) and
|
|
|
+ (left.nodetype in [gtn,gten,ltn,lten]) and IsSingleStatement(right,thenstmnt) and
|
|
|
+ ((t1=nil) or IsSingleStatement(t1,elsestmnt)) and
|
|
|
(thenstmnt.nodetype=assignn) and ((t1=nil) or (elsestmnt.nodetype=assignn)) and
|
|
|
not(might_have_sideeffects(left)) and
|
|
|
((t1=nil) or tassignmentnode(thenstmnt).left.isequal(tassignmentnode(elsestmnt).left)) and
|
|
@@ -1623,16 +1624,36 @@ implementation
|
|
|
{$if defined(xtensa)}
|
|
|
(CPUXTENSA_HAS_MINMAX in cpu_capabilities[current_settings.cputype]) and is_32bitint(tassignmentnode(thenstmnt).right.resultdef) and
|
|
|
{$endif defined(xtensa)}
|
|
|
+ (
|
|
|
{ the right size of the assignment in the then clause must either }
|
|
|
|
|
|
- { equal to the left ... } { ... and the else clause must be either not exist } { or the else clause exists and the right side of the assignment in the else clause }
|
|
|
- { and the left side of the assignment in the then clause must be } { must be equal to the right side of the comparison operator }
|
|
|
- { equal to the right operand of the comparison operator }
|
|
|
- ((tassignmentnode(thenstmnt).right.isequal(taddnode(left).left) and (((t1=nil) and (tassignmentnode(thenstmnt).left.isequal(taddnode(left).right))) or (assigned(elsestmnt) and tassignmentnode(elsestmnt).right.isequal(taddnode(left).right)))) or
|
|
|
- { ... or right operand of the comparison operator } { ... and the else clause must be either not exist } { or the else clause exists and the right side of the assignment in the else clause }
|
|
|
- { and the left side of the assignment in the then clause must be } { must be equal to the left side of the comparison operator }
|
|
|
- { equal to the left operand of the comparison operator }
|
|
|
- (tassignmentnode(thenstmnt).right.isequal(taddnode(left).right) and (((t1=nil) and (tassignmentnode(thenstmnt).left.isequal(taddnode(left).left))) or (assigned(elsestmnt) and tassignmentnode(elsestmnt).right.isequal(taddnode(left).left))))
|
|
|
+ { equal to the left ... }
|
|
|
+ (tassignmentnode(thenstmnt).right.isequal(taddnode(left).left) and
|
|
|
+
|
|
|
+ { ... and the else clause must be either not exist }
|
|
|
+ { and the left side of the assignment in the then clause must be }
|
|
|
+ { equal to the right operand of the comparison operator }
|
|
|
+ (
|
|
|
+ ((t1=nil) and (tassignmentnode(thenstmnt).left.isequal(taddnode(left).right))) or
|
|
|
+
|
|
|
+ { or the else clause exists and the right side of the assignment in the else clause }
|
|
|
+ { must be equal to the right side of the comparison operator }
|
|
|
+ (assigned(elsestmnt) and tassignmentnode(elsestmnt).right.isequal(taddnode(left).right)))
|
|
|
+ ) or
|
|
|
+ { ... or right operand of the comparison operator }
|
|
|
+
|
|
|
+ (tassignmentnode(thenstmnt).right.isequal(taddnode(left).right) and
|
|
|
+ { ... and the else clause must be either not exist }
|
|
|
+ { and the left side of the assignment in the then clause must be }
|
|
|
+ { equal to the left operand of the comparison operator }
|
|
|
+ (
|
|
|
+ ((t1=nil) and (tassignmentnode(thenstmnt).left.isequal(taddnode(left).left))) or
|
|
|
+
|
|
|
+ { or the else clause exists and the right side of the assignment in the else clause }
|
|
|
+ { must be equal to the left side of the comparison operator }
|
|
|
+ (assigned(elsestmnt) and tassignmentnode(elsestmnt).right.isequal(taddnode(left).left))
|
|
|
+ )
|
|
|
+ )
|
|
|
) then
|
|
|
begin
|
|
|
paratype:=tassignmentnode(thenstmnt).left.resultdef;
|