* New blocknode optimisation that removes goto nodes that come right before the label they jump to

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2024-05-07 07:22:53 +01:00 committed by J. Gareth "Kit" Moreton
parent f817167760
commit 2734225935

View File

@ -371,7 +371,7 @@ implementation
ppu,
symsym,symconst,symdef,defutil,defcmp,
pass_1,
nutils,nld,ncnv,
nutils,nld,ncnv,nflw,
procinfo
{$ifdef DEBUG_NODE_XML}
{$ifndef jvm}
@ -872,6 +872,19 @@ implementation
n.right := MergeNestedBlock(p);
Continue;
end;
goton:
begin
last := TStatementNode(p.Next);
if Assigned(last) and
Assigned(last.statement) and
(TGotoNode(p.statement).labelnode = last.statement) then
begin
{ Goto jumps to a label that immediately follows it }
n.right := p.PruneKeepRight();
p.Free;
Continue;
end;
end;
else
;
end;