summaryrefslogtreecommitdiff
path: root/ir_copy_propagation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ir_copy_propagation.cpp')
-rw-r--r--ir_copy_propagation.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/ir_copy_propagation.cpp b/ir_copy_propagation.cpp
index e395fa9723..82172d29b6 100644
--- a/ir_copy_propagation.cpp
+++ b/ir_copy_propagation.cpp
@@ -267,18 +267,13 @@ add_copy(ir_assignment *ir, exec_list *acp)
return;
}
- ir_dereference *lhs_deref = ir->lhs->as_dereference();
- if (!lhs_deref || lhs_deref->mode != ir_dereference::ir_reference_variable)
- return;
- ir_variable *lhs_var = lhs_deref->variable_referenced();
-
- ir_dereference *rhs_deref = ir->rhs->as_dereference();
- if (!rhs_deref || rhs_deref->mode != ir_dereference::ir_reference_variable)
- return;
- ir_variable *rhs_var = rhs_deref->variable_referenced();
-
- entry = new acp_entry(lhs_var, rhs_var);
- acp->push_tail(entry);
+ ir_variable *lhs_var = ir->lhs->whole_variable_referenced();
+ ir_variable *rhs_var = ir->rhs->whole_variable_referenced();
+
+ if ((lhs_var != NULL) && (rhs_var != NULL)) {
+ entry = new acp_entry(lhs_var, rhs_var);
+ acp->push_tail(entry);
+ }
}
static void