[Mesa-dev] [PATCH v2 5/5] compiler/list: avoid downcasting list sentinel nodes (v2)

Nicolai Hähnle nhaehnle at gmail.com
Fri May 13 04:50:53 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

v2: don't add new macros
---
 src/compiler/glsl/lower_jumps.cpp | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp
index 3cfa2e0..b62e76e 100644
--- a/src/compiler/glsl/lower_jumps.cpp
+++ b/src/compiler/glsl/lower_jumps.cpp
@@ -797,21 +797,19 @@ lower_continue:
              * any instructions that that are already wrapped in the
              * appropriate guard.
              */
-            ir_instruction* ir_after;
-            for(ir_after = (ir_instruction*)ir->get_next(); !ir_after->is_tail_sentinel();)
-            {
-               ir_if* ir_if = ir_after->as_if();
+            for (exec_node *next = ir->get_next(); !next->is_tail_sentinel();) {
+               ir_instruction *const ir = (ir_instruction *) next;
+               next = next->next;
+
+               ir_if* ir_if = ir->as_if();
                if(ir_if && ir_if->else_instructions.is_empty()) {
                   ir_dereference_variable* ir_if_cond_deref = ir_if->condition->as_dereference_variable();
                   if(ir_if_cond_deref && ir_if_cond_deref->var == this->loop.execute_flag) {
-                     ir_instruction* ir_next = (ir_instruction*)ir_after->get_next();
-                     ir_after->insert_before(&ir_if->then_instructions);
-                     ir_after->remove();
-                     ir_after = ir_next;
+                     ir->insert_before(&ir_if->then_instructions);
+                     ir->remove();
                      continue;
                   }
                }
-               ir_after = (ir_instruction*)ir_after->get_next();
 
                /* only set this if we find any unprotected instruction */
                this->progress = true;
-- 
2.7.4



More information about the mesa-dev mailing list