shader: Read branch conditions from an instruction
Fixes the identity removal pass.
This commit is contained in:
parent
4bad415bca
commit
9bb3e008c9
12 changed files with 36 additions and 16 deletions
|
@ -200,7 +200,7 @@ void Precolor(EmitContext& ctx, const IR::Program& program) {
|
|||
}
|
||||
// Add reference to the phi node on the phi predecessor to avoid overwritting it
|
||||
for (size_t i = 0; i < num_args; ++i) {
|
||||
IR::IREmitter{*phi.PhiBlock(i)}.DummyReference(IR::Value{&phi});
|
||||
IR::IREmitter{*phi.PhiBlock(i)}.Reference(IR::Value{&phi});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) {
|
|||
Alias(inst, value);
|
||||
}
|
||||
|
||||
void EmitConditionRef(EmitContext&, IR::Inst& inst, const IR::Value& value) {
|
||||
Alias(inst, value);
|
||||
}
|
||||
|
||||
void EmitBitCastU16F16(EmitContext&, IR::Inst& inst, const IR::Value& value) {
|
||||
Alias(inst, value);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ class EmitContext;
|
|||
void EmitPhi(EmitContext& ctx, IR::Inst& inst);
|
||||
void EmitVoid(EmitContext& ctx);
|
||||
void EmitIdentity(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
|
||||
void EmitDummyReference(EmitContext&);
|
||||
void EmitConditionRef(EmitContext& ctx, IR::Inst& inst, const IR::Value& value);
|
||||
void EmitReference(EmitContext&);
|
||||
void EmitPhiMove(EmitContext& ctx, const IR::Value& phi, const IR::Value& value);
|
||||
void EmitJoin(EmitContext& ctx);
|
||||
void EmitDemoteToHelperInvocation(EmitContext& ctx);
|
||||
|
|
|
@ -21,7 +21,7 @@ void EmitPhi(EmitContext&, IR::Inst&) {}
|
|||
|
||||
void EmitVoid(EmitContext&) {}
|
||||
|
||||
void EmitDummyReference(EmitContext&) {}
|
||||
void EmitReference(EmitContext&) {}
|
||||
|
||||
void EmitPhiMove(EmitContext& ctx, const IR::Value& phi, const IR::Value& value) {
|
||||
if (phi == value) {
|
||||
|
|
|
@ -139,6 +139,7 @@ void RegAlloc::Free(Id id) {
|
|||
/*static*/ bool RegAlloc::IsAliased(const IR::Inst& inst) {
|
||||
switch (inst.GetOpcode()) {
|
||||
case IR::Opcode::Identity:
|
||||
case IR::Opcode::ConditionRef:
|
||||
case IR::Opcode::BitCastU16F16:
|
||||
case IR::Opcode::BitCastU32F32:
|
||||
case IR::Opcode::BitCastU64F64:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue