mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 22:47:59 +02:00
* run dead store elimination multiple times if needed
This commit is contained in:
parent
a0366d7d28
commit
342524c312
@ -31,7 +31,7 @@ unit optdeadstore;
|
||||
uses
|
||||
node;
|
||||
|
||||
function do_optdeadstoreelim(var rootnode : tnode) : tnode;
|
||||
function do_optdeadstoreelim(var rootnode : tnode;changed: boolean) : tnode;
|
||||
|
||||
implementation
|
||||
|
||||
@ -106,9 +106,7 @@ unit optdeadstore;
|
||||
end;
|
||||
|
||||
|
||||
function do_optdeadstoreelim(var rootnode: tnode): tnode;
|
||||
var
|
||||
changed: boolean;
|
||||
function do_optdeadstoreelim(var rootnode: tnode;changed: boolean): tnode;
|
||||
begin
|
||||
{$ifdef EXTDEBUG_DEADSTORE}
|
||||
writeln('******************* Tree before deadstore elimination **********************');
|
||||
|
@ -1294,15 +1294,22 @@ implementation
|
||||
tabstractnormalvarsym(tloadnode(dfabuilder.nodemap[i]).symtableentry).noregvarinitneeded:=true
|
||||
end;
|
||||
end;
|
||||
|
||||
if cs_opt_dead_store_eliminate in current_settings.optimizerswitches then
|
||||
begin
|
||||
changed:=false;
|
||||
repeat
|
||||
do_optdeadstoreelim(code,changed);
|
||||
if changed then
|
||||
dfabuilder.redodfainfo(code);
|
||||
until not(changed);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
ConvertForLoops(code);
|
||||
end;
|
||||
|
||||
if (pi_dfaavailable in flags) and (cs_opt_dead_store_eliminate in current_settings.optimizerswitches) then
|
||||
do_optdeadstoreelim(code);
|
||||
|
||||
if (cs_opt_remove_empty_proc in current_settings.optimizerswitches) and
|
||||
(procdef.proctypeoption in [potype_operator,potype_procedure,potype_function]) and
|
||||
(code.nodetype=blockn) and (tblocknode(code).statements=nil) then
|
||||
|
Loading…
Reference in New Issue
Block a user