- ctx.info[idx].exec.back().first = bld.pseudo(aco_opcode::p_parallelcopy, bld.def(bld.lm, exec),
- ctx.info[idx].exec.back().first);
+ if (need_parallelcopy) {
+ /* only create this parallelcopy is needed, since the operand isn't
+ * fixed to exec which causes the spiller to miscalculate register demand */
+ /* TODO: Fix register_demand calculation for spilling on loop exits.
+ * The problem is only mitigated because the register demand could be
+ * higher if the exec phi doesn't get assigned to exec. */
+ ctx.info[idx].exec.back().first = bld.pseudo(aco_opcode::p_parallelcopy, bld.def(bld.lm, exec),
+ ctx.info[idx].exec.back().first);
+ }