Skip to content

Commit 097fae8

Browse files
committed
[ENCODEGEN] Fix functions that return a parameter
Always mark result registers as used so that corresponding ScratchRegs get declared.
1 parent a8f2367 commit 097fae8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tpde-encodegen/src/encode_gen.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,10 @@ bool create_encode_function(llvm::MachineFunction *func,
977977
auto &mach_reg_info = func->getRegInfo();
978978
// const auto &target_reg_info = func->getSubtarget().getRegisterInfo();
979979

980+
// Mark return registers as used.
981+
for (auto reg_id : state.return_regs) {
982+
state.used_regs.insert(reg_id);
983+
}
980984

981985
// map inputs
982986
{
@@ -989,7 +993,6 @@ bool create_encode_function(llvm::MachineFunction *func,
989993
state.param_names.push_back(std::move(name));
990994

991995
const auto reg_id = target->reg_id_from_mc_reg(it->first);
992-
assert(!state.used_regs.contains(reg_id));
993996
state.used_regs.insert(reg_id);
994997
state.asm_operand_refs[reg_id] = state.param_names[idx++];
995998
state.operand_ref_counts[state.param_names.back()] = 1;

0 commit comments

Comments
 (0)