mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 13:56:59 +01:00
shader: drop the duplicate-use scan from Inst::AddUse
This commit is contained in:
@@ -256,9 +256,6 @@ void Inst::Invalidate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Inst::AddUse(Inst* used, size_t operand) {
|
void Inst::AddUse(Inst* used, size_t operand) {
|
||||||
const auto found = std::ranges::find_if(
|
|
||||||
used->uses, [&](const Use& use) { return use.user == this && use.operand == operand; });
|
|
||||||
EXIT_IF(found != used->uses.end());
|
|
||||||
used->uses.push_back({this, operand});
|
used->uses.push_back({this, operand});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -300,8 +300,12 @@ void TestOperandMutationLifecycle() {
|
|||||||
auto *source = definition.TryInstruction();
|
auto *source = definition.TryInstruction();
|
||||||
const auto inserted = fixture.Emit(ValueOpcode::BitFieldInsert,
|
const auto inserted = fixture.Emit(ValueOpcode::BitFieldInsert,
|
||||||
{definition, definition, Value(4u), Value(4u)});
|
{definition, definition, Value(4u), Value(4u)});
|
||||||
Check(source->UseCount() == 2, "inline operands lost distinct reverse-use indices");
|
auto *consumer = inserted.TryInstruction();
|
||||||
inserted.TryInstruction()->SetArg(1, Value(3u));
|
Check(source->Uses() == std::vector<Use>({{consumer, 0}, {consumer, 1}}),
|
||||||
|
"inline operands lost distinct reverse-use indices");
|
||||||
|
consumer->SetArg(0, definition);
|
||||||
|
Check(source->UseCount() == 2, "re-setting an operand to its value duplicated its use");
|
||||||
|
consumer->SetArg(1, Value(3u));
|
||||||
Check(source->UseCount() == 1, "inline operand mutation did not detach its old use");
|
Check(source->UseCount() == 1, "inline operand mutation did not detach its old use");
|
||||||
source->ReplaceUsesWith(Value(0xaau));
|
source->ReplaceUsesWith(Value(0xaau));
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user