Mesa (master): nir/opt_deref: Add an instruction type switch
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 2 07:46:24 UTC 2020
Module: Mesa
Branch: master
Commit: 80e6ac3341c257e75a0c0f279493ee157fad5043
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80e6ac3341c257e75a0c0f279493ee157fad5043
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Sat Aug 15 11:02:46 2020 -0500
nir/opt_deref: Add an instruction type switch
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6871>
---
src/compiler/nir/nir_deref.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 0d83266c9cd..96ac786c0e0 100644
--- a/src/compiler/nir/nir_deref.c
+++ b/src/compiler/nir/nir_deref.c
@@ -1116,22 +1116,28 @@ nir_opt_deref_impl(nir_function_impl *impl)
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
- if (instr->type != nir_instr_type_deref)
- continue;
-
b.cursor = nir_before_instr(instr);
- nir_deref_instr *deref = nir_instr_as_deref(instr);
- switch (deref->deref_type) {
- case nir_deref_type_ptr_as_array:
- if (opt_deref_ptr_as_array(&b, deref))
- progress = true;
- break;
-
- case nir_deref_type_cast:
- if (opt_deref_cast(&b, deref))
- progress = true;
+ switch (instr->type) {
+ case nir_instr_type_deref: {
+ nir_deref_instr *deref = nir_instr_as_deref(instr);
+ switch (deref->deref_type) {
+ case nir_deref_type_ptr_as_array:
+ if (opt_deref_ptr_as_array(&b, deref))
+ progress = true;
+ break;
+
+ case nir_deref_type_cast:
+ if (opt_deref_cast(&b, deref))
+ progress = true;
+ break;
+
+ default:
+ /* Do nothing */
+ break;
+ }
break;
+ }
default:
/* Do nothing */
More information about the mesa-commit
mailing list