glsl/loops: Remove unnecessary list walk from loop_control_visitor.
When loop_control_visitor::visit_leave(ir_loop *) is analyzing a loop terminator that acts on a certain ir_variable, it doesn't need to walk the list of induction variables to find the loop_variable entry corresponding to the variable. It can just look it up in the loop_variable_state hashtable and verify that the loop_variable entry represents an induction variable. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
@@ -189,6 +189,15 @@ public:
|
||||
ir_rvalue *increment;
|
||||
|
||||
|
||||
inline bool is_induction_var() const
|
||||
{
|
||||
/* Induction variables always have a non-null increment, and vice
|
||||
* versa.
|
||||
*/
|
||||
return this->increment != NULL;
|
||||
}
|
||||
|
||||
|
||||
inline bool is_loop_constant() const
|
||||
{
|
||||
const bool is_const = (this->num_assignments == 0)
|
||||
|
@@ -237,10 +237,8 @@ loop_control_visitor::visit_leave(ir_loop *ir)
|
||||
|
||||
ir_rvalue *init = find_initial_value(ir, var);
|
||||
|
||||
foreach_list(iv_node, &ls->induction_variables) {
|
||||
loop_variable *lv = (loop_variable *) iv_node;
|
||||
|
||||
if (lv->var == var) {
|
||||
loop_variable *lv = ls->get(var);
|
||||
if (lv != NULL && lv->is_induction_var()) {
|
||||
const int iterations = calculate_iterations(init, limit,
|
||||
lv->increment,
|
||||
cmp);
|
||||
@@ -269,7 +267,6 @@ loop_control_visitor::visit_leave(ir_loop *ir)
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user