* do not apply node CSE to nested loads on high level cpu targets, because

their nested tree already contains the load (subscriptn) for the variable
    itself and there is no clean/easy way to avoid that in a completely
    portable way in ncgnstld + test

git-svn-id: trunk@22519 -
This commit is contained in:
Jonas Maebe 2012-10-02 18:12:24 +00:00
parent a34c1ff22d
commit ae56841ee6
2 changed files with 14 additions and 2 deletions

View File

@ -234,6 +234,17 @@ unit optcse;
DFASetExclude(plists(arg)^.avail,i);
result:=fen_norecurse_false;
end;
{$ifdef cpuhighleveltarget}
{ The high level targets use the functionality from ncgnstld for
nested accesses, and that one stores the complete location of the
nested variable in tloadnode.left rather than only the location of
the parent context containing it. This causes problems with the
CSE in case the nested variable is used as an lvalue, so disable
CSE in that case
}
if (n.nodetype=loadn) and assigned(tloadnode(n).left) then
result:=fen_norecurse_false;
{$endif}
end;

View File

@ -34,14 +34,14 @@ procedure outer(var para: byte);
procedure doubleinner;
begin
b:=3;
b:=b+1;
end;
begin
b:=2;
doubleinner;
if b<>3 then
raise JLException.Create('b');
inner;
end;
begin
@ -52,6 +52,7 @@ procedure outer(var para: byte);
raise JLException.Create('a2');
if para<>3 then
raise JLException.Create('para2');
inner2;
end;
var