diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-05-14 17:36:00 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-05-14 17:36:00 -0700 |
commit | 5d82e239f98060c6de37f31f3900d84ee43aa4e5 (patch) | |
tree | 6e9523b9986342f93f3a88713e4c556ef9f0a89f | |
parent | 2b3c476fa08e33a0ee1633b173a7df31ecaca582 (diff) |
Use ir_rvalue::variable_referenced instead of open-coding it
-rw-r--r-- | ir_copy_propagation.cpp | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/ir_copy_propagation.cpp b/ir_copy_propagation.cpp index 6c34652..aac12b3 100644 --- a/ir_copy_propagation.cpp +++ b/ir_copy_propagation.cpp @@ -234,32 +234,14 @@ propagate_copies(ir_instruction *ir, exec_list *acp) static void kill_invalidated_copies(ir_assignment *ir, exec_list *acp) { - ir_instruction *current = ir->lhs; + ir_variable *var = ir->lhs->variable_referenced(); + assert(var != NULL); - /* Walk down the dereference chain to find the variable at the end - * of it that we're actually modifying. - */ - while (current != NULL) { - ir_swizzle *swiz; - ir_dereference *deref; - - if ((swiz = current->as_swizzle())) { - current = swiz->val; - } else if ((deref = current->as_dereference())) { - current = deref->var; - } else { - ir_variable *var = current->as_variable(); - assert(var); - - foreach_iter(exec_list_iterator, iter, *acp) { - acp_entry *entry = (acp_entry *)iter.get(); - - if (entry->lhs == var || entry->rhs == var) { - entry->remove(); - } - } - current = NULL; - break; + foreach_iter(exec_list_iterator, iter, *acp) { + acp_entry *entry = (acp_entry *)iter.get(); + + if (entry->lhs == var || entry->rhs == var) { + entry->remove(); } } } |