imageworks/OpenShadingLanguage — pull request #274 by lgritz (2013-07-11 21:13:02+00:00)
Title: Constant fold Dx, Dy, Dz, area, filterwidth when passed a constant

Fairly simple -- notice when these functions take a constant value (it can happen) and don't just generate "return 0" for the LLVM code, go even farther than know that it'll be zero while doing runtime optimization (which could cascade into other optimizations).

Unfortunately, the several scenes I tried did not experience any significant speedup. But others could benefit from this, and I don't see any possible harm.