nir/opt_shrink_vectors: reverse iteration order
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 16 Jun 2021 07:20:01 +0000 (09:20 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 26 Jul 2021 09:24:37 +0000 (09:24 +0000)
This pass should be backwards in order to reach the fixed point
in linear time.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11411>

src/compiler/nir/nir_opt_shrink_vectors.c

index 6aa4bd5..45284dc 100644 (file)
@@ -258,8 +258,8 @@ nir_opt_shrink_vectors(nir_shader *shader, bool shrink_image_store)
       nir_builder b;
       nir_builder_init(&b, function->impl);
 
-      nir_foreach_block(block, function->impl) {
-         nir_foreach_instr(instr, block) {
+      nir_foreach_block_reverse(block, function->impl) {
+         nir_foreach_instr_reverse(instr, block) {
             progress |= opt_shrink_vectors_instr(&b, instr, shrink_image_store);
          }
       }