diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-05-02 16:19:29 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-06-15 10:39:49 +0200 |
commit | 677c42f48db303582167f6492f82444a4283fdf6 (patch) | |
tree | 4f55c0cc86f155d8dc4e81f7b19d48b1de495a8c | |
parent | 28ea45bbebab37b0653bf85a3842183ede09fb99 (diff) |
compiler/list: avoid downcasting list sentinel nodes (v2)
v2: don't add new macros
-rw-r--r-- | src/compiler/glsl/lower_jumps.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp index 3cfa2e00ae..b62e76e44f 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; |