vc4: Reuse list_for_each_entry_safe_rev().
authorEric Anholt <eric@anholt.net>
Wed, 16 Mar 2016 01:50:32 +0000 (18:50 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 16 Mar 2016 18:28:34 +0000 (11:28 -0700)
This didn't exist when I wrote the code.

src/gallium/drivers/vc4/vc4_opt_dead_code.c

index 9e79a2d1b2e0b11d691f967931a551df0ada5011..44d0779c6113469dfb26d81fcb9f2f850c72dac3 100644 (file)
@@ -86,12 +86,8 @@ qir_opt_dead_code(struct vc4_compile *c)
         /* Whether we're eliminating texture setup currently. */
         bool dce_tex = false;
 
-        struct list_head *node, *t;
-        for (node = c->instructions.prev, t = node->prev;
-             &c->instructions != node;
-             node = t, t = t->prev) {
-                struct qinst *inst = (struct qinst *)node;
-
+        list_for_each_entry_safe_rev(struct qinst, inst, &c->instructions,
+                                     link) {
                 if (inst->dst.file == QFILE_TEMP &&
                     !used[inst->dst.index] &&
                     !inst->sf &&