nir: Unset metadata debug bit if no progress made
authorMatt Turner <mattst88@gmail.com>
Mon, 10 Sep 2018 21:31:29 +0000 (14:31 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 10 Jan 2019 00:42:40 +0000 (16:42 -0800)
commit2623653126985be5aca1a29e24bdecb4bb42c8b4
treeed143cc0df8f0a91fd36d15ebce95251dfe855a4
parente633fae5cb160aec66195364fac05af359503be7
nir: Unset metadata debug bit if no progress made

NIR metadata validation verifies that the debug bit was unset (by a call
to nir_metadata_preserve) if a NIR optimization pass made progress on
the shader. With the expectation that the NIR shader consists of only a
single main function, it has been safe to call nir_metadata_preserve()
iff progress was made.

However, most optimization passes calculate progress per-function and
then return the union of those calculations. In the case that an
optimization pass makes progress only on a subset of the functions in
the shader metadata validation will detect the debug bit is still set on
any unchanged functions resulting in a failed assertion.

This patch offers a quick solution (short of a larger scale refactoring
which I do not wish to undertake as part of this series) that simply
unsets the debug bit on unchanged functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
22 files changed:
src/compiler/nir/nir_algebraic.py
src/compiler/nir/nir_deref.c
src/compiler/nir/nir_inline_functions.c
src/compiler/nir/nir_lower_constant_initializers.c
src/compiler/nir/nir_lower_double_ops.c
src/compiler/nir/nir_lower_global_vars_to_local.c
src/compiler/nir/nir_lower_int64.c
src/compiler/nir/nir_lower_load_const_to_scalar.c
src/compiler/nir/nir_lower_returns.c
src/compiler/nir/nir_lower_var_copies.c
src/compiler/nir/nir_lower_vars_to_ssa.c
src/compiler/nir/nir_opt_constant_folding.c
src/compiler/nir/nir_opt_copy_prop_vars.c
src/compiler/nir/nir_opt_copy_propagate.c
src/compiler/nir/nir_opt_cse.c
src/compiler/nir/nir_opt_dce.c
src/compiler/nir/nir_opt_dead_cf.c
src/compiler/nir/nir_opt_if.c
src/compiler/nir/nir_opt_peephole_select.c
src/compiler/nir/nir_opt_remove_phis.c
src/compiler/nir/nir_opt_undef.c
src/compiler/nir/nir_split_var_copies.c