+ if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
+ for (int i = 0; i < src_size; i++) {
+ reg_to_offset[i] = i;
+ }
+ mov[0] = inst;
+ channels_remaining -= inst->regs_written;
+ } else {
+ const int offset = inst->src[0].reg_offset;
+ if (mov[offset]) {
+ /* This is the second time that this offset in the register has
+ * been set. This means, in particular, that inst->dst was
+ * live before this instruction and that the live ranges of
+ * inst->dst and inst->src[0] overlap and we can't coalesce the
+ * two variables. Let's ensure that doesn't happen.
+ */
+ channels_remaining = -1;
+ continue;
+ }
+ reg_to_offset[offset] = inst->dst.reg_offset;
+ if (inst->regs_written > 1)
+ reg_to_offset[offset + 1] = inst->dst.reg_offset + 1;
+ mov[offset] = inst;
+ channels_remaining -= inst->regs_written;
+ }