Fix swaps and other misoptimizations

This undoes 454d44e85f
This commit is contained in:
Sei Lisa 2019-01-11 02:07:54 +01:00
parent c3bb056f05
commit 42f47d38f0
3 changed files with 18 additions and 9 deletions

View file

@ -322,13 +322,18 @@ class deadcode(object):
node = sym['W']
nt = node.nt
while nt == 'IDENT':
# Follow the chain of identifiers all the way to the original
if self.symtab[node.scope][node.name].get('W', False) is False:
return sym
sym = self.symtab[node.scope][node.name]
node = sym['W']
nt = node.nt
# This screws up swaps. See
# unit_tests/regression.suite/aggressive-local-removal.lsl
# It can't be done without a reliable CFG-based method (SSA or
# the like).
# while nt == 'IDENT':
# # Follow the chain of identifiers all the way to the original
# if self.symtab[node.scope][node.name].get('W', False) is False:
# return sym
# sym = self.symtab[node.scope][node.name]
# node = sym['W']
# nt = node.nt
if nt == 'CONST':
tcurnode = curnode.t

View file

@ -17,8 +17,9 @@ default
{
{
{
integer f2param = 4;
{
llOwnerSay("f2:" + "4");
llOwnerSay("f2:" + (string)f2param);
}
}
{

View file

@ -2,6 +2,9 @@ default
{
state_entry()
{
llOwnerSay("x" + "3");
integer b = 3;
integer c = b;
integer d = c;
llOwnerSay("x" + (string)d);
}
}