https://bugs.freedesktop.org/show_bug.cgi?id=93594
--- Comment #9 from Michel Dänzer michel@daenzer.net --- (In reply to Marek Olšák from comment #8)
If KILL_IF masks out some but not all invocations in a 2x2 quad, the subsequent DDX and DDY opcodes can result in undefined values, resulting in garbage on the output.
I think Nicolai is making some improvements for the EXEC mask handling for shader images. Maybe that'll help for this as well.
Note that AFAIK using things like derivatives in non-uniform control flow isn't supported by GLSL. What's the original GLSL shader?