diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 94564ffa2cb..8f0e2f13f98 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -884,6 +884,10 @@ public: temp = t; } + void swapTemp(Definition& other) noexcept { + std::swap(temp, other.temp); + } + constexpr RegClass regClass() const noexcept { return temp.regClass(); diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 4266696b9fb..d804faf1d8f 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -2674,7 +2674,7 @@ bool apply_omod_clamp(opt_ctx &ctx, Block& block, aco_ptr& instr) return false; } - std::swap(instr->definitions[0], def_info.instr->definitions[0]); + instr->definitions[0].swapTemp(def_info.instr->definitions[0]); ctx.info[instr->definitions[0].tempId()].label &= label_clamp; ctx.uses[def_info.instr->definitions[0].tempId()]--; @@ -2806,7 +2806,7 @@ void combine_vop3p(opt_ctx &ctx, Block& block, aco_ptr& instr) VOP3P_instruction* candidate = &ctx.info[instr->operands[0].tempId()].instr->vop3p(); candidate->clamp = true; propagate_swizzles(candidate, vop3p->opsel_lo, vop3p->opsel_hi); - std::swap(instr->definitions[0], candidate->definitions[0]); + instr->definitions[0].swapTemp(candidate->definitions[0]); ctx.info[candidate->definitions[0].tempId()].instr = candidate; ctx.uses[instr->definitions[0].tempId()]--; return;