Files to reproduce problem
glsl_reduced.frag is a minimized GLSL shader. When compiled to SPIR-V with glslangValidator we get glsl_reduced.spv. This has been further reduced using spirv-reduce to spiv_reduced.spv.
Doing:
spirv-opt spirv_reduced.spv --inline-entry-points-exhaustive --private-to-local
--ccp --merge-blocks --eliminate-dead-branches --eliminate-dead-branches --combi
ne-access-chains --reduce-load-size --redundancy-elimination --convert-local-acc
ess-chains --convert-local-access-chains --eliminate-dead-inserts --private-to-l
ocal --reduce-load-size --ccp --eliminate-dead-branches --merge-return --elimina
te-dead-inserts --eliminate-local-multi-store --inline-entry-points-exhaustive -
-eliminate-dead-branches --eliminate-dead-code-aggressive --eliminate-local-sing
le-store --eliminate-local-multi-store --reduce-load-size --inline-entry-points-
exhaustive --copy-propagate-arrays --if-conversion --simplify-instructions --ccp
--eliminate-local-multi-store -o temp.spv
spirv-val temp.spv
should trigger the problem:
error: line 71: ID 144[%144] defined in block 142[%142] does not dominate its us
e in block 152[%152]
%152 = OpLabel
I did not try to reduce the spirv-opt flags, in case (as with #2450) there may be an issue both with the optimizer generating invalid code and the validator not picking this up soon enough.
Found using GraphicsFuzz