From 4d371d5f5f4db6f0e38270d7508887275f4e1665 Mon Sep 17 00:00:00 2001 From: nmzik Date: Tue, 8 Sep 2026 11:43:37 +0400 Subject: [PATCH] shader: reuse initial SSA types --- .../recompiler/ir/passes/SsaRewrite.cpp | 44 +------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp b/src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp index ce89b9008..fa6455145 100644 --- a/src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp +++ b/src/graphics/shader/recompiler/ir/passes/SsaRewrite.cpp @@ -123,46 +123,6 @@ struct DefTable { std::unordered_map goto_variables; }; -ValueOpcode UndefOpcode(ScalarReg) { - return ValueOpcode::UndefU32; -} -ValueOpcode UndefOpcode(ThreadBitScalarReg) { - return ValueOpcode::UndefU1; -} -ValueOpcode UndefOpcode(ScalarMaskTag) { - return ValueOpcode::UndefU1; -} -ValueOpcode UndefOpcode(VectorReg) { - return ValueOpcode::UndefU32; -} -ValueOpcode UndefOpcode(GotoVariable) { - return ValueOpcode::UndefU1; -} -ValueOpcode UndefOpcode(SccTag) { - return ValueOpcode::UndefU1; -} -ValueOpcode UndefOpcode(ExecTag) { - return ValueOpcode::UndefU1; -} -ValueOpcode UndefOpcode(ExecLoTag) { - return ValueOpcode::UndefU32; -} -ValueOpcode UndefOpcode(ExecHiTag) { - return ValueOpcode::UndefU32; -} -ValueOpcode UndefOpcode(VccTag) { - return ValueOpcode::UndefU1; -} -ValueOpcode UndefOpcode(VccLoTag) { - return ValueOpcode::UndefU32; -} -ValueOpcode UndefOpcode(VccHiTag) { - return ValueOpcode::UndefU32; -} -ValueOpcode UndefOpcode(M0Tag) { - return ValueOpcode::UndefU32; -} - Value InitialValue(ScalarReg) { return Value(0u); } @@ -248,7 +208,7 @@ public: state.result = def; } else if (!block->IsSsaSealed()) { auto& phi = *block->PrependNewInst(block->begin(), ValueOpcode::Phi); - phi.SetFlags(TypeOf(UndefOpcode(variable))); + phi.SetFlags(InitialValue(variable).GetType()); incomplete_phis[block][Variable(variable)] = φ state.result = Value(&phi); } else if (const auto predecessors = block->ImmPredecessors(); @@ -258,7 +218,7 @@ public: break; } else { auto& phi = *block->PrependNewInst(block->begin(), ValueOpcode::Phi); - phi.SetFlags(TypeOf(UndefOpcode(variable))); + phi.SetFlags(InitialValue(variable).GetType()); Write(variable, block, Value(&phi)); state.phi = φ prepare_phi();