aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_peephole_select.c
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2018-09-10 14:31:29 -0700
committerMatt Turner <[email protected]>2019-01-09 16:42:40 -0800
commit2623653126985be5aca1a29e24bdecb4bb42c8b4 (patch)
treeed143cc0df8f0a91fd36d15ebce95251dfe855a4 /src/compiler/nir/nir_opt_peephole_select.c
parente633fae5cb160aec66195364fac05af359503be7 (diff)
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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_peephole_select.c')
-rw-r--r--src/compiler/nir/nir_opt_peephole_select.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c
index b27cdd28a99..1deb02a380e 100644
--- a/src/compiler/nir/nir_opt_peephole_select.c
+++ b/src/compiler/nir/nir_opt_peephole_select.c
@@ -282,8 +282,13 @@ nir_opt_peephole_select_impl(nir_function_impl *impl, unsigned limit,
expensive_alu_ok);
}
- if (progress)
+ if (progress) {
nir_metadata_preserve(impl, nir_metadata_none);
+ } else {
+#ifndef NDEBUG
+ impl->valid_metadata &= ~nir_metadata_not_properly_reset;
+#endif
+ }
return progress;
}