nir/algrbraic: Don't optimize open-coded bitfield reverse when lowering is enabled
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 26 Aug 2019 20:28:09 +0000 (13:28 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 28 Aug 2019 18:38:51 +0000 (11:38 -0700)
commitd3fd1c761aab01e06665180ab86c9528c0b285b2
tree34eadbae076c5d8ed511434ee40f007778b9d0dd
parent4662b70d23c2eed9b891e9694d956a1a2a37ab70
nir/algrbraic: Don't optimize open-coded bitfield reverse when lowering is enabled

This caused a problem on Sandybridge where an open-coded
bitfieldReverse() function could be optimized to a
nir_op_bitfield_reverse that would generate an unsupported BFREV
instruction in the backend.  This was encountered in some Unreal4 tech
demos in shader-db.  The bug was not previously noticed because we don't
actually try to run those demos on Sandybridge.

The fixes tag is a bit a lie.  The actual bug was introduced about
26,000 commits earlier in 371c4b3c48f ("nir: Recognize open-coded
bitfield_reverse.").  Without the NIR lowering pass, the flag needed to
avoid the optimization does not exist.  Hopefully nobody will care to
fix this on an earlier Mesa release.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Fixes: 7afa26d4e39 ("nir: Add lowering for nir_op_bitfield_reverse.")
src/compiler/nir/nir_opt_algebraic.py