glasm: Fix aliased bitcasts ref counting

This commit is contained in:
ReinUsesLisp
2021-05-17 19:24:09 -03:00
committed by ameerj
parent f1b334b9f9
commit fb3ba62b3a
3 changed files with 42 additions and 13 deletions

View File

@ -12,12 +12,10 @@ static void Alias(IR::Inst& inst, const IR::Value& value) {
if (value.IsImmediate()) {
return;
}
IR::Inst* const value_inst{value.InstRecursive()};
if (inst.GetOpcode() == IR::Opcode::Identity) {
value_inst->DestructiveAddUsage(inst.UseCount());
value_inst->DestructiveRemoveUsage();
}
inst.SetDefinition(value_inst->Definition<Id>());
IR::Inst& value_inst{RegAlloc::AliasInst(*value.Inst())};
value_inst.DestructiveAddUsage(inst.UseCount());
value_inst.DestructiveRemoveUsage();
inst.SetDefinition(value_inst.Definition<Id>());
}
void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) {