[Mesa-dev] [PATCH 2/3] SQUASH/i965/opt_move_comparisons: get rid of the tuple

Jason Ekstrand jason at jlekstrand.net
Wed Jan 11 20:48:27 UTC 2017


---
 src/compiler/nir/nir_opt_move_comparisons.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/src/compiler/nir/nir_opt_move_comparisons.c b/src/compiler/nir/nir_opt_move_comparisons.c
index 535009b..2bfd940 100644
--- a/src/compiler/nir/nir_opt_move_comparisons.c
+++ b/src/compiler/nir/nir_opt_move_comparisons.c
@@ -100,20 +100,14 @@ move_comparison_source(nir_src *src, nir_block *block, nir_instr *before)
    return false;
 }
 
-/* nir_foreach_src callback boilerplate */
-struct nomc_tuple
-{
-   nir_instr *instr;
-   bool progress;
-};
-
 static bool
 move_comparison_source_cb(nir_src *src, void *data)
 {
-   struct nomc_tuple *tuple = data;
+   bool *progress = data;
 
-   if (move_comparison_source(src, tuple->instr->block, tuple->instr))
-      tuple->progress = true;
+   nir_instr *instr = src->parent_instr;
+   if (move_comparison_source(src, instr->block, instr))
+      *progress = true;
 
    return true; /* nir_foreach_src should keep going */
 }
@@ -151,9 +145,7 @@ move_comparisons(nir_block *block)
                                                block, instr);
          }
       } else {
-         struct nomc_tuple tuple = { instr, false };
-         nir_foreach_src(instr, move_comparison_source_cb, &tuple);
-         progress |= tuple.progress;
+         nir_foreach_src(instr, move_comparison_source_cb, &progress);
       }
    }
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list