[CPU] Disable context promotion only for vertex type

This commit is contained in:
Gliniak
2026-01-25 20:30:48 +01:00
committed by Radosław Gliński
parent 67d80958c9
commit a74fe21f76

View File

@@ -105,7 +105,7 @@ void ContextPromotionPass::PromoteBlock(Block* block) {
// Volatile instruction - requires all context values be flushed. // Volatile instruction - requires all context values be flushed.
validity.reset(); validity.reset();
} else if (i->opcode == &OPCODE_LOAD_CONTEXT_info) { } else if (i->opcode == &OPCODE_LOAD_CONTEXT_info) {
size_t offset = i->src1.offset; const size_t offset = i->src1.offset;
if (validity.test(static_cast<uint32_t>(offset))) { if (validity.test(static_cast<uint32_t>(offset))) {
// Legit previous value, reuse. // Legit previous value, reuse.
Value* previous_value = context_values_[offset]; Value* previous_value = context_values_[offset];
@@ -113,15 +113,19 @@ void ContextPromotionPass::PromoteBlock(Block* block) {
i->set_src1(previous_value); i->set_src1(previous_value);
} else { } else {
// Store the loaded value into the table. // Store the loaded value into the table.
context_values_[offset] = i->dest; if (i->dest->type != TypeName::VEC128_TYPE) {
validity.set(static_cast<uint32_t>(offset)); context_values_[offset] = i->dest;
validity.set(static_cast<uint32_t>(offset));
}
} }
} else if (i->opcode == &OPCODE_STORE_CONTEXT_info) { } else if (i->opcode == &OPCODE_STORE_CONTEXT_info) {
size_t offset = i->src1.offset; const size_t offset = i->src1.offset;
Value* value = i->src2.value; Value* value = i->src2.value;
// Store value into the table for later. if (value->type != TypeName::VEC128_TYPE) {
context_values_[offset] = value; // Store value into the table for later.
validity.set(static_cast<uint32_t>(offset)); context_values_[offset] = value;
validity.set(static_cast<uint32_t>(offset));
}
} }
i = next; i = next;
} }
@@ -140,13 +144,16 @@ void ContextPromotionPass::RemoveDeadStoresBlock(Block* block) {
// Volatile instruction - requires all context values be flushed. // Volatile instruction - requires all context values be flushed.
validity.reset(); validity.reset();
} else if (i->opcode == &OPCODE_STORE_CONTEXT_info) { } else if (i->opcode == &OPCODE_STORE_CONTEXT_info) {
size_t offset = i->src1.offset; const size_t offset = i->src1.offset;
if (!validity.test(static_cast<uint32_t>(offset))) { const Value* value = i->src2.value;
// Offset not yet written, mark and continue. if (value->type != TypeName::VEC128_TYPE) {
validity.set(static_cast<uint32_t>(offset)); if (!validity.test(static_cast<uint32_t>(offset))) {
} else { // Offset not yet written, mark and continue.
// Already written to. Remove this store. validity.set(static_cast<uint32_t>(offset));
i->UnlinkAndNOP(); } else {
// Already written to. Remove this store.
i->UnlinkAndNOP();
}
} }
} }
i = prev; i = prev;