mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 06:50:18 +02:00
* optimize additions of empty sets away if possible, part of #40384
This commit is contained in:
parent
edaee6f392
commit
e35403c3b8
@ -3597,6 +3597,7 @@ implementation
|
|||||||
temp : ttempcreatenode;
|
temp : ttempcreatenode;
|
||||||
begin
|
begin
|
||||||
result:=nil;
|
result:=nil;
|
||||||
|
|
||||||
case nodetype of
|
case nodetype of
|
||||||
equaln,unequaln,lten,gten:
|
equaln,unequaln,lten,gten:
|
||||||
begin
|
begin
|
||||||
@ -4302,9 +4303,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
{$ifdef addstringopt}
|
|
||||||
hp : tnode;
|
|
||||||
{$endif addstringopt}
|
|
||||||
rd,ld : tdef;
|
rd,ld : tdef;
|
||||||
i,i2 : longint;
|
i,i2 : longint;
|
||||||
lt,rt : tnodetype;
|
lt,rt : tnodetype;
|
||||||
@ -4389,6 +4387,17 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ get rid of adding empty sets generated by set constructors (s+([]+[..]))
|
||||||
|
|
||||||
|
this needs to be done before firstpass, else the set additions get already converted into calls }
|
||||||
|
if (resultdef.typ=setdef) and (nodetype=addn) and (right.nodetype=addn) and (is_emptyset(taddnode(right).left)) then
|
||||||
|
begin
|
||||||
|
result:=caddnode.create(addn,left,taddnode(right).right);
|
||||||
|
left:=nil;
|
||||||
|
taddnode(right).right:=nil;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
{ first do the two subtrees }
|
{ first do the two subtrees }
|
||||||
firstpass(left);
|
firstpass(left);
|
||||||
firstpass(right);
|
firstpass(right);
|
||||||
|
Loading…
Reference in New Issue
Block a user