[Mesa-dev] [PATCH 20/22] glsl: Fix indentation left weird from the previous commit
Ian Romanick
idr at freedesktop.org
Thu Sep 21 14:34:33 UTC 2017
From: "\"Ian Romanick\"" <idr at freedesktop.org>
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/glsl/opt_dead_code_local.cpp | 168 +++++++++++-----------
src/mesa/program/ir_to_mesa.cpp | 10 +-
2 files changed, 89 insertions(+), 89 deletions(-)
diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
index 1de281a..121605d 100644
--- a/src/compiler/glsl/opt_dead_code_local.cpp
+++ b/src/compiler/glsl/opt_dead_code_local.cpp
@@ -192,93 +192,93 @@ process_assignment(void *lin_ctx, ir_assignment *ir, exec_list *assignments)
assert(var);
/* Now, check if we did a whole-variable assignment. */
- ir_dereference_variable *deref_var = ir->lhs->as_dereference_variable();
+ ir_dereference_variable *deref_var = ir->lhs->as_dereference_variable();
- /* If it's a vector type, we can do per-channel elimination of
- * use of the RHS.
+ /* If it's a vector type, we can do per-channel elimination of
+ * use of the RHS.
+ */
+ if (deref_var && (deref_var->var->type->is_scalar() ||
+ deref_var->var->type->is_vector())) {
+
+ if (debug)
+ printf("looking for %s.0x%01x to remove\n", var->name,
+ ir->write_mask);
+
+ foreach_in_list_safe(assignment_entry, entry, assignments) {
+ if (entry->lhs != var)
+ continue;
+
+ /* Skip if the assignment we're trying to eliminate isn't a plain
+ * variable deref. */
+ if (entry->ir->lhs->ir_type != ir_type_dereference_variable)
+ continue;
+
+ int remove = entry->unused & ir->write_mask;
+ if (debug) {
+ printf("%s 0x%01x - 0x%01x = 0x%01x\n",
+ var->name,
+ entry->ir->write_mask,
+ remove, entry->ir->write_mask & ~remove);
+ }
+ if (remove) {
+ progress = true;
+
+ if (debug) {
+ printf("rewriting:\n ");
+ entry->ir->print();
+ printf("\n");
+ }
+
+ entry->ir->write_mask &= ~remove;
+ entry->unused &= ~remove;
+ if (entry->ir->write_mask == 0) {
+ /* Delete the dead assignment. */
+ entry->ir->remove();
+ entry->remove();
+ } else {
+ void *mem_ctx = ralloc_parent(entry->ir);
+ /* Reswizzle the RHS arguments according to the new
+ * write_mask.
+ */
+ unsigned components[4];
+ unsigned channels = 0;
+ unsigned next = 0;
+
+ for (int i = 0; i < 4; i++) {
+ if ((entry->ir->write_mask | remove) & (1 << i)) {
+ if (!(remove & (1 << i)))
+ components[channels++] = next;
+ next++;
+ }
+ }
+
+ entry->ir->rhs = new(mem_ctx) ir_swizzle(entry->ir->rhs,
+ components,
+ channels);
+ if (debug) {
+ printf("to:\n ");
+ entry->ir->print();
+ printf("\n");
+ }
+ }
+ }
+ }
+ } else if (ir->whole_variable_written() != NULL) {
+ /* We did a whole-variable assignment. So, any instruction in
+ * the assignment list with the same LHS is dead.
*/
- if (deref_var && (deref_var->var->type->is_scalar() ||
- deref_var->var->type->is_vector())) {
-
- if (debug)
- printf("looking for %s.0x%01x to remove\n", var->name,
- ir->write_mask);
-
- foreach_in_list_safe(assignment_entry, entry, assignments) {
- if (entry->lhs != var)
- continue;
-
- /* Skip if the assignment we're trying to eliminate isn't a plain
- * variable deref. */
- if (entry->ir->lhs->ir_type != ir_type_dereference_variable)
- continue;
-
- int remove = entry->unused & ir->write_mask;
- if (debug) {
- printf("%s 0x%01x - 0x%01x = 0x%01x\n",
- var->name,
- entry->ir->write_mask,
- remove, entry->ir->write_mask & ~remove);
- }
- if (remove) {
- progress = true;
-
- if (debug) {
- printf("rewriting:\n ");
- entry->ir->print();
- printf("\n");
- }
-
- entry->ir->write_mask &= ~remove;
- entry->unused &= ~remove;
- if (entry->ir->write_mask == 0) {
- /* Delete the dead assignment. */
- entry->ir->remove();
- entry->remove();
- } else {
- void *mem_ctx = ralloc_parent(entry->ir);
- /* Reswizzle the RHS arguments according to the new
- * write_mask.
- */
- unsigned components[4];
- unsigned channels = 0;
- unsigned next = 0;
-
- for (int i = 0; i < 4; i++) {
- if ((entry->ir->write_mask | remove) & (1 << i)) {
- if (!(remove & (1 << i)))
- components[channels++] = next;
- next++;
- }
- }
-
- entry->ir->rhs = new(mem_ctx) ir_swizzle(entry->ir->rhs,
- components,
- channels);
- if (debug) {
- printf("to:\n ");
- entry->ir->print();
- printf("\n");
- }
- }
- }
- }
- } else if (ir->whole_variable_written() != NULL) {
- /* We did a whole-variable assignment. So, any instruction in
- * the assignment list with the same LHS is dead.
- */
- if (debug)
- printf("looking for %s to remove\n", var->name);
- foreach_in_list_safe(assignment_entry, entry, assignments) {
- if (entry->lhs == var) {
- if (debug)
- printf("removing %s\n", var->name);
- entry->ir->remove();
- entry->remove();
- progress = true;
- }
- }
+ if (debug)
+ printf("looking for %s to remove\n", var->name);
+ foreach_in_list_safe(assignment_entry, entry, assignments) {
+ if (entry->lhs == var) {
+ if (debug)
+ printf("removing %s\n", var->name);
+ entry->ir->remove();
+ entry->remove();
+ progress = true;
+ }
}
+ }
/* Add this instruction to the assignment list available to be removed. */
assignment_entry *entry = new(lin_ctx) assignment_entry(var, ir);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index db9eacf..cb29d97 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1871,11 +1871,11 @@ ir_to_mesa_visitor::visit(ir_assignment *ir)
assert(l.file != PROGRAM_UNDEFINED);
assert(r.file != PROGRAM_UNDEFINED);
- for (i = 0; i < type_size(ir->lhs->type); i++) {
- emit(ir, OPCODE_MOV, l, r);
- l.index++;
- r.index++;
- }
+ for (i = 0; i < type_size(ir->lhs->type); i++) {
+ emit(ir, OPCODE_MOV, l, r);
+ l.index++;
+ r.index++;
+ }
}
--
2.9.5
More information about the mesa-dev
mailing list