You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is similar to #1146 but likely has a different root cause. Consider this shader:
vector foo(float x, string a)
{
vector result = 0;
if( x >= -1 && a != "" )
{
result = 1;
}
return result;
}
surface simple(string s = "")
{
P += foo(u, s);
}
Once again, testshade --debug simple.oso yields:
Globals written: (1) P
Making the condition simpler:
vector foo(float x, string a)
{
vector result = 0;
if( a != "" )
{
result = 1;
}
return result;
}
is enough to get proper optimization:
Globals written: (0)
As that second condition can clearly be proven false, the first one should be easy to prove false also. So I would expect it to be optimized the same way.
Versions
OSL branch/version: 1.10.9 (testshade output above) / 3d0a284 (where I originally found the issue in a larger network)
OS: linux
LLVM version: 9.0.1 / 6.0.0
The text was updated successfully, but these errors were encountered:
More interesting trivia: swapping the condition to fix the optimization made a scene with some particularly ugly shader networks render 2.75 times faster.
This is similar to #1146 but likely has a different root cause. Consider this shader:
Once again,
testshade --debug simple.oso
yields:Making the condition simpler:
is enough to get proper optimization:
As that second condition can clearly be proven false, the first one should be easy to prove false also. So I would expect it to be optimized the same way.
Versions
The text was updated successfully, but these errors were encountered: