diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index fefaea6a5..e84908a57 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later + #include #include #include diff --git a/src/shader_recompiler/ir/microinstruction.cpp b/src/shader_recompiler/ir/microinstruction.cpp index 8c907ef7d..e663f5eea 100644 --- a/src/shader_recompiler/ir/microinstruction.cpp +++ b/src/shader_recompiler/ir/microinstruction.cpp @@ -32,8 +32,6 @@ Inst::Inst(const Inst& base) : op{base.op}, flags{base.flags} { } Inst::~Inst() { - // necessary? Or are all Insts destroyed at once? - ClearArgs(); if (op == Opcode::Phi) { std::destroy_at(&phi_args); } else { @@ -178,9 +176,8 @@ void Inst::ClearArgs() { } void Inst::ReplaceUsesWith(Value replacement, bool preserve) { - // Could also do temp_uses = std::move(uses) - // But clearer this way // Copy since user->SetArg will mutate this->uses + // Could also do temp_uses = std::move(uses) but more readable boost::container::list temp_uses = uses; for (auto& [user, operand] : temp_uses) { DEBUG_ASSERT(user->Arg(operand).Inst() == this); @@ -208,9 +205,7 @@ void Inst::ReplaceOpcode(IR::Opcode opcode) { } void Inst::Use(Inst* used, u32 operand) { - DEBUG_ASSERT(std::none_of(used->uses.begin(), used->uses.end(), [&](const IR::Use& use) { - return use.operand == operand && use.user == this; - })); + DEBUG_ASSERT(0 == std::count(used->uses.begin(), used->uses.end(), IR::Use(this, operand))); used->uses.emplace_front(this, operand); }