summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-05-18 13:53:20 +0200
committerIan Romanick <ian.d.romanick@intel.com>2010-05-18 13:53:20 +0200
commit461c294ac57e387aa2355cfd2aa93cefaba03baa (patch)
tree04074570d0477d1db82eb223f1daab3498728de5
parentc65cfef317484a8be24fddd5e65a362aebb5c382 (diff)
Use ir_rvalue::variable_referenced instead of open coding ithierarchical_visitor
-rw-r--r--ir_dead_code.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/ir_dead_code.cpp b/ir_dead_code.cpp
index 20b791e..aa8ebf8 100644
--- a/ir_dead_code.cpp
+++ b/ir_dead_code.cpp
@@ -146,28 +146,8 @@ ir_dead_code_visitor::visit_leave(ir_dereference *ir)
ir_visitor_status
ir_dead_code_visitor::visit_leave(ir_assignment *ir)
{
- ir_instruction *lhs = ir->lhs;
-
- /* Walk through the LHS and mark references for variables used in
- * array indices but not for the assignment dereference.
- */
- while (lhs) {
- if (lhs->as_variable())
- break;
-
- ir_dereference *deref = lhs->as_dereference();
- if (deref) {
- lhs = deref->var;
- } else {
- ir_swizzle *swiz = lhs->as_swizzle();
-
- lhs = swiz->val;
- }
- }
-
-
variable_entry *entry;
- entry = this->get_variable_entry(lhs->as_variable());
+ entry = this->get_variable_entry(ir->lhs->variable_referenced());
if (entry) {
entry->assigned_count++;
if (entry->assign == NULL)