aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_if_simplification.cpp
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-04-15 12:30:40 +0200
committerKenneth Graunke <[email protected]>2014-04-16 23:39:57 -0700
commitcda5e0c25ea5f8ab38b69f1f04099acfa3f0ced2 (patch)
treeb414a531b7f6c4529d42e72c3cb7b022ab4ac9a7 /src/glsl/opt_if_simplification.cpp
parent4472ab9e6d7940dcdd627de6bd4fca0cc43651f9 (diff)
glsl: Small optimization for constant conditionals
Once the relevant branch has been identified do not iterate over the instructions in the branch, do a linked list insertion instead to avoid the loop. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/opt_if_simplification.cpp')
-rw-r--r--src/glsl/opt_if_simplification.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/glsl/opt_if_simplification.cpp b/src/glsl/opt_if_simplification.cpp
index 2bec8252ea5..e05f03190aa 100644
--- a/src/glsl/opt_if_simplification.cpp
+++ b/src/glsl/opt_if_simplification.cpp
@@ -90,15 +90,9 @@ ir_if_simplification_visitor::visit_leave(ir_if *ir)
* that matters out.
*/
if (condition_constant->value.b[0]) {
- foreach_list_safe(n, &ir->then_instructions) {
- ir_instruction *then_ir = (ir_instruction *) n;
- ir->insert_before(then_ir);
- }
+ ir->insert_before(&ir->then_instructions);
} else {
- foreach_list_safe(n, &ir->else_instructions) {
- ir_instruction *else_ir = (ir_instruction *) n;
- ir->insert_before(else_ir);
- }
+ ir->insert_before(&ir->else_instructions);
}
ir->remove();
this->made_progress = true;