X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fopt_dead_code_local.cpp;h=39962bd602ef8ba89a2ad34eba903d82cdbdc437;hb=f6572017b94a137a4102342ebf6cd20dedc90271;hp=4bbedf0ff946e50c222c6aa1d69a228384c3e3e5;hpb=32aaf89823de11e98cb59d5ec78c66cd3e74bcd4;p=mesa.git diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp index 4bbedf0ff94..39962bd602e 100644 --- a/src/glsl/opt_dead_code_local.cpp +++ b/src/glsl/opt_dead_code_local.cpp @@ -22,7 +22,7 @@ */ /** - * \file ir_dead_code_local.cpp + * \file opt_dead_code_local.cpp * * Eliminates local dead assignments from the code. * @@ -129,15 +129,8 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) var = ir->lhs->variable_referenced(); assert(var); - bool always_assign = true; - if (ir->condition) { - ir_constant *condition = ir->condition->as_constant(); - if (!condition || !condition->value.b[0]) - always_assign = false; - } - /* Now, check if we did a whole-variable assignment. */ - if (always_assign && (ir->whole_variable_written() != NULL)) { + if (!ir->condition && (ir->whole_variable_written() != NULL)) { /* We did a whole-variable assignment. So, any instruction in * the assignment list with the same LHS is dead. */ @@ -190,7 +183,7 @@ dead_code_local_basic_block(ir_instruction *first, bool *out_progress = (bool *)data; bool progress = false; - void *ctx = talloc_new(NULL); + void *ctx = ralloc_context(NULL); /* Safe looping, since process_assignment */ for (ir = first, ir_next = (ir_instruction *)first->next;; ir = ir_next, ir_next = (ir_instruction *)ir->next) { @@ -212,7 +205,7 @@ dead_code_local_basic_block(ir_instruction *first, break; } *out_progress = progress; - talloc_free(ctx); + ralloc_free(ctx); } /**