AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage
missed optimization
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 414
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 10
Description
This trivial shader:
```
surface myshader ( color something = 0 )
{
Ci = 0;
if( something != 0 )
{
Ci += transparent();
}
}
```
will report using the transparent closure after shading group optimization. But change the if to `if( something != color(0) )` and it will correctly optimize and report not using the closure.
Tested against 0efbf04f5cf26a30e4c682ee39a3a248287209c5 but this has been around for years as far as I can tell. The shader is alone in the shading group and no parameters are set.
### Versions
* OSL branch/version: master, see above.
* OS: Linux
* C++ compiler: clang 6.0
* LLVM version: 6.0
* OIIO version: d64d435a4bd95ab26bc5b7388f951a92b1b1e3ee
Contributor guide
Assessment
This issue has not been assessed yet.