glsl: When disabling gl_PerVertex variables, check that mode matches.
glsl: When disabling gl_PerVertex variables, check that mode matches.

In commit 1b4a737 (glsl: Support redeclaration of VS and GS
gl_PerVertex output), I added code to ensure that when an unnamed
gl_PerVertex interface block is redeclared, any ir_variables that
weren't included in the redeclaration are removed from the IR (and the
symbol table).  This ensures that only those variables that were
explicitly redeclared may be used.

However, when I wrote this code, I neglected to match the variable
mode when finding variables to remove.  This meant that redeclaring a
built-in output block might cause the built-in input gl_in to be
accidentally removed.

Fixes piglit test gs-redeclares-pervertex-out-only.

Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Reviewed-by: Matt Turner <789b315743a28dd066a4ba1459c35951c291d8a6@gmail.com>

mapbox/glsl-optimizer,tokyovigilante/glsl-optimizer,dellis1972/glsl-optimizer,benaadams/glsl-optimizer,jbarczak/glsl-optimizer,mapbox/glsl-optimizer,zeux/glsl-optimizer,jbarczak/glsl-optimizer,djreep81/glsl-optimizer,benaadams/glsl-optimizer,mapbox/glsl-optimizer,bkaradzic/glsl-optimizer,wolf96/glsl-optimizer,bkaradzic/glsl-optimizer,tokyovigilante/glsl-optimizer,zeux/glsl-optimizer,dellis1972/glsl-optimizer,bkaradzic/glsl-optimizer,zeux/glsl-optimizer,benaadams/glsl-optimizer,mcanthony/glsl-optimizer,mcanthony/glsl-optimizer,metora/MesaGLSLCompiler,djreep81/glsl-optimizer,djreep81/glsl-optimizer,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,djreep81/glsl-optimizer,zz85/glsl-optimizer,tokyovigilante/glsl-optimizer,mcanthony/glsl-optimizer,zeux/glsl-optimizer,jbarczak/glsl-optimizer,dellis1972/glsl-optimizer,mcanthony/glsl-optimizer,wolf96/glsl-optimizer,tokyovigilante/glsl-optimizer,bkaradzic/glsl-optimizer,zz85/glsl-optimizer,dellis1972/glsl-optimizer,tokyovigilante/glsl-optimizer,zz85/glsl-optimizer,wolf96/glsl-optimizer,zz85/glsl-optimizer,djreep81/glsl-optimizer,wolf96/glsl-optimizer,zeux/glsl-optimizer,wolf96/glsl-optimizer,benaadams/glsl-optimizer,mcanthony/glsl-optimizer,zz85/glsl-optimizer,dellis1972/glsl-optimizer,mapbox/glsl-optimizer,jbarczak/glsl-optimizer,jbarczak/glsl-optimizer,benaadams/glsl-optimizer,zz85/glsl-optimizer,mapbox/glsl-optimizer,benaadams/glsl-optimizer,bkaradzic/glsl-optimizer