LSL-PyOptimizer
LSL-PyOptimizer copied to clipboard
Constant folding does not work when variable is used in multiple vectors
In the following code:
default
{
touch_start(integer total_number)
{
float val = 1.0;
vector vec1 = <val + val, 0, 0>;
vector vec2 = <val + val, 0, 0>;
llOwnerSay((string)vec1);
llOwnerSay((string)vec2);
}
touch_end(integer total_number)
{
float val = 1.0;
vector vec1 = <val + val, 0, 0>;
llOwnerSay((string)vec1);
}
}
touch_start does not fully fold the constants:
default
{
touch_start(integer total_number)
{
float val = 1.;
vector vec1 = <val + val, 0, 0>;
vector vec2 = <val + val, 0, 0>;
llOwnerSay((string)vec1);
llOwnerSay((string)vec2);
}
touch_end(integer total_number)
{
vector vec1 = <2., 0., 0.>;
llOwnerSay((string)vec1);
}
}
Options used: Constant Folding and Dead Code Removal. (In the online version of the optimizer)
Expected: both vec1 and vec2 should resolve to <2., 0., 0.>