glsl: Delete dead discard conditions in constant folding.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Feb 2015 09:00:22 +0000 (01:00 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Feb 2015 23:24:52 +0000 (15:24 -0800)
commit23d42b46e306d4104e534842f6dec3500d331cae
tree8d69a06dd7973bdf68cd63eff26565c34243b758
parentd77b186871389be10a68546da0e3ada8134ae539
glsl: Delete dead discard conditions in constant folding.

opt_constant_folding() already detects conditional assignments where the
condition is constant, and either deletes the assignment or the
condition.

Make it handle discards in the same fashion.

Spotted happening in the wild in Tropico 5 shaders.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/opt_constant_folding.cpp