From: Ian Romanick Date: Wed, 2 Jun 2010 20:50:27 +0000 (-0700) Subject: ir_dereference_array always operates on an r-value X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=384c051b8c7a53aa805836723bd43f2d496303ff;p=mesa.git ir_dereference_array always operates on an r-value 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. --- diff --git a/ir_vec_index_to_swizzle.cpp b/ir_vec_index_to_swizzle.cpp index 1deb0d381ec..f0900cf70d6 100644 --- a/ir_vec_index_to_swizzle.cpp +++ b/ir_vec_index_to_swizzle.cpp @@ -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