A C++ library that takes GLSL shaders, does some GPU-independent optimizations on them and outputs GLSL or Metal source back. Optimizations are function inlining, dead code removal, copy propagation, constant folding, constant propagation, arithmetic optimizations and so on.

Source: aras-p/glsl-optimizer: GLSL optimizer based on Mesa’s GLSL compiler. Used in Unity for mobile shader optimization.