* more aggressive cse on thread vars

This commit is contained in:
florian 2025-03-29 22:31:13 +01:00
parent ce6db34224
commit 84a852bc13

View File

@ -48,6 +48,7 @@ unit optcse;
uses uses
globtype,globals, globtype,globals,
systems,
cutils,cclasses, cutils,cclasses,
nutils,compinnr, nutils,compinnr,
nbas,nld,ninl,ncal,nadd,nmem,ncnv, nbas,nld,ninl,ncal,nadd,nmem,ncnv,
@ -645,7 +646,13 @@ unit optcse;
end; end;
end; end;
if found then if found then
inc(consts^[i].weight) begin
inc(consts^[i].weight);
{ non-sectioned threadvars really hurt so do more aggressive cse on them }
if not(tf_section_threadvars in target_info.flags) and (n.nodetype=loadn) and (tloadnode(n).symtableentry.typ=staticvarsym) and (vo_is_thread_var in tstaticvarsym(tloadnode(n).symtableentry).varoptions) then
inc(consts^[i].weight);
end
else else
begin begin
SetLength(consts^,length(consts^)+1); SetLength(consts^,length(consts^)+1);