LibJS: Optimize away Mov instructions when the source is the destination

This commit is contained in:
Lucien Fiorini 2025-03-28 00:56:57 +01:00 committed by Andreas Kling
commit 5707076b9e
Notes: github-actions[bot] 2025-03-28 11:22:15 +00:00
2 changed files with 66 additions and 53 deletions

View file

@ -127,6 +127,18 @@ public:
emit_with_extra_slots<OpType, Value>(extra_operand_slots, forward<Args>(args)...);
}
void emit_mov(ScopedOperand const& dst, ScopedOperand const& src)
{
// Optimize away when the source is the destination
if (dst != src)
emit<Op::Mov>(dst, src);
}
void emit_mov(Operand const& dst, Operand const& src)
{
emit<Op::Mov>(dst, src);
}
void emit_jump_if(ScopedOperand const& condition, Label true_target, Label false_target);
struct ReferenceOperands {