This means, I think that if we reverse the list_move_tail() in the array indexing rule, there's no reason that we can't just always use a synthetic load when lowering indices.
Okay, I will reverse the `list_move_tail()` ordering, but I am not sure I understand the rest of the sentence. Patch 10/10 indeed stores the hlsl_ir_index "vals" to a synthetic var, so that then the `lower_index_loads` pass turns them into hlsl_ir_loads to that synthetic var.
The point is patch 10/10 guards that on "val->type != HLSL_IR_INDEX", but I don't think we want that.
And yes, I'm pretty sure we can't just get rid of that conditional. I haven't thought it through fully, but I think everything here needs to be one pass, and it presumably needs to convert one index at a time rather than transforming multiple dereferences at once into a single load.