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