diff options
Diffstat (limited to 'ir_constant_folding.cpp')
-rw-r--r-- | ir_constant_folding.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ir_constant_folding.cpp b/ir_constant_folding.cpp index b9dee37edf..006eb5ffcf 100644 --- a/ir_constant_folding.cpp +++ b/ir_constant_folding.cpp @@ -88,7 +88,14 @@ ir_constant_folding_visitor::visit(ir_swizzle *ir) void ir_constant_folding_visitor::visit(ir_dereference *ir) { - (void) ir; + if (ir->mode == ir_dereference::ir_reference_array) { + ir_constant *const_val = ir->selector.array_index->constant_expression_value(); + if (const_val) + ir->selector.array_index = const_val; + else + ir->selector.array_index->accept(this); + } + ir->var->accept(this); } |