summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv.cpp3
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.cpp4
-rw-r--r--src/shader_recompiler/frontend/ir/value.cpp6
3 files changed, 11 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
index 2e7e6bb0c..6389d80bf 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp
@@ -288,7 +288,8 @@ Id EmitPhi(EmitContext& ctx, IR::Inst* inst) {
288 operands.push_back(PhiArgDef(ctx, inst, index)); 288 operands.push_back(PhiArgDef(ctx, inst, index));
289 operands.push_back(inst->PhiBlock(index)->Definition<Id>()); 289 operands.push_back(inst->PhiBlock(index)->Definition<Id>());
290 } 290 }
291 const Id result_type{TypeId(ctx, inst->Arg(0).Type())}; 291 // The type of a phi instruction is stored in its flags
292 const Id result_type{TypeId(ctx, inst->Flags<IR::Type>())};
292 return ctx.OpPhi(result_type, std::span(operands.data(), operands.size())); 293 return ctx.OpPhi(result_type, std::span(operands.data(), operands.size()));
293} 294}
294 295
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp
index c3ba6b522..074c71d53 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.cpp
+++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp
@@ -193,6 +193,10 @@ void Inst::AddPhiOperand(Block* predecessor, const Value& value) {
193 if (!value.IsImmediate()) { 193 if (!value.IsImmediate()) {
194 Use(value); 194 Use(value);
195 } 195 }
196 if (Flags<IR::Type>() == IR::Type::Void) {
197 // Set the type of the phi node
198 SetFlags<IR::Type>(value.Type());
199 }
196 phi_args.emplace_back(predecessor, value); 200 phi_args.emplace_back(predecessor, value);
197} 201}
198 202
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp
index e8e4662e7..837c1b487 100644
--- a/src/shader_recompiler/frontend/ir/value.cpp
+++ b/src/shader_recompiler/frontend/ir/value.cpp
@@ -56,7 +56,11 @@ bool Value::IsLabel() const noexcept {
56} 56}
57 57
58IR::Type Value::Type() const noexcept { 58IR::Type Value::Type() const noexcept {
59 if (IsIdentity() || IsPhi()) { 59 if (IsPhi()) {
60 // The type of a phi node is stored in its flags
61 return inst->Flags<IR::Type>();
62 }
63 if (IsIdentity()) {
60 return inst->Arg(0).Type(); 64 return inst->Arg(0).Type();
61 } 65 }
62 if (type == Type::Opaque) { 66 if (type == Type::Opaque) {