ir_dereference_array always operates on an r-value
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 2 Jun 2010 20:50:27 +0000 (13:50 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 2 Jun 2010 20:50:27 +0000 (13:50 -0700)
ir_dereference_array::array is always an r-value.  If the dereference
is of a varaible, that r-value will be an ir_dereference_variable.
This simplifies the code a bit.

ir_vec_index_to_swizzle.cpp

index 1deb0d381ecd4a229d73637dde27c64dd1509d1e..f0900cf70d64980a755dd484b176d677d9c1945a 100644 (file)
@@ -64,7 +64,6 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir)
 {
    ir_dereference_array *deref = ir->as_dereference_array();
    ir_constant *ir_constant;
-   ir_rvalue *deref_var;
 
    if (!deref)
       return ir;
@@ -72,20 +71,13 @@ ir_vec_index_to_swizzle_visitor::convert_vec_index_to_swizzle(ir_rvalue *ir)
    if (deref->array->type->is_matrix() || deref->array->type->is_array())
       return ir;
 
-   deref_var = deref->array->as_rvalue();
-   if (!deref_var) {
-      ir_variable *var = deref->array->as_variable();
-      assert(var);
-      deref_var = new ir_dereference_variable(var);
-   }
-
    assert(deref->array_index->type->base_type == GLSL_TYPE_INT);
    ir_constant = deref->array_index->constant_expression_value();
    if (!ir_constant)
       return ir;
 
    this->progress = true;
-   return new ir_swizzle(deref_var, ir_constant->value.i[0], 0, 0, 0, 1);
+   return new ir_swizzle(deref->array, ir_constant->value.i[0], 0, 0, 0, 1);
 }
 
 ir_visitor_status