forked from suyu/suyu
shader: Fix dependency on identity removal pass
This commit is contained in:
parent
5f22cd89e2
commit
f1dd743731
2 changed files with 8 additions and 3 deletions
|
@ -114,7 +114,7 @@ EmitContext::~EmitContext() = default;
|
||||||
|
|
||||||
Id EmitContext::Def(const IR::Value& value) {
|
Id EmitContext::Def(const IR::Value& value) {
|
||||||
if (!value.IsImmediate()) {
|
if (!value.IsImmediate()) {
|
||||||
return value.Inst()->Definition<Id>();
|
return value.InstRecursive()->Definition<Id>();
|
||||||
}
|
}
|
||||||
switch (value.Type()) {
|
switch (value.Type()) {
|
||||||
case IR::Type::Void:
|
case IR::Type::Void:
|
||||||
|
|
|
@ -250,7 +250,7 @@ Id PhiArgDef(EmitContext& ctx, IR::Inst* inst, size_t index) {
|
||||||
// Let the context handle immediate definitions, as it already knows how
|
// Let the context handle immediate definitions, as it already knows how
|
||||||
return ctx.Def(arg);
|
return ctx.Def(arg);
|
||||||
}
|
}
|
||||||
IR::Inst* const arg_inst{arg.Inst()};
|
IR::Inst* const arg_inst{arg.InstRecursive()};
|
||||||
if (const Id def{arg_inst->Definition<Id>()}; Sirit::ValidId(def)) {
|
if (const Id def{arg_inst->Definition<Id>()}; Sirit::ValidId(def)) {
|
||||||
// Return the current definition if it exists
|
// Return the current definition if it exists
|
||||||
return def;
|
return def;
|
||||||
|
@ -296,7 +296,12 @@ Id EmitPhi(EmitContext& ctx, IR::Inst* inst) {
|
||||||
void EmitVoid(EmitContext&) {}
|
void EmitVoid(EmitContext&) {}
|
||||||
|
|
||||||
Id EmitIdentity(EmitContext& ctx, const IR::Value& value) {
|
Id EmitIdentity(EmitContext& ctx, const IR::Value& value) {
|
||||||
return ctx.Def(value);
|
if (const Id id = ctx.Def(value); Sirit::ValidId(id)) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
const Id def{ctx.ForwardDeclarationId()};
|
||||||
|
value.InstRecursive()->SetDefinition<Id>(def);
|
||||||
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitGetZeroFromOp(EmitContext&) {
|
void EmitGetZeroFromOp(EmitContext&) {
|
||||||
|
|
Loading…
Reference in a new issue