glsl: replace 'x + (-x)' with constant 0
This fixes a hang in shadertoy where a buffer was initialized with:
value -= value
with value being
In this case LLVM replace the operation with an assignment to NaN.
Questions: I'm not sure if this is the correct place to implement this? maybe a better fix would be to ask LLVM to not emit NaN in this case, but a more sensible value (0 ?). But maybe this doesn't make sense from the compiler perspective.
v1: implemented for tgsi
v2: implemented in glsl/opt_algebraic.c