From 571c5760a4e3661ea5296a6af2d93e7be0f68cff Mon Sep 17 00:00:00 2001 From: Andrew Morris Date: Sun, 2 Jul 2023 09:20:59 +1000 Subject: [PATCH] Allow sub instructions to be simplified to mov --- valuescript_compiler/src/optimization/kal.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/valuescript_compiler/src/optimization/kal.rs b/valuescript_compiler/src/optimization/kal.rs index 708a36f..c867e7b 100644 --- a/valuescript_compiler/src/optimization/kal.rs +++ b/valuescript_compiler/src/optimization/kal.rs @@ -493,7 +493,8 @@ impl FnState { | OpRightShift(_, _, dst) | OpRightShiftUnsigned(_, _, dst) | InstanceOf(_, _, dst) - | In(_, _, dst) => match self.get(dst.name.clone()).try_to_value() { + | In(_, _, dst) + | Sub(_, _, dst) => match self.get(dst.name.clone()).try_to_value() { Some(value) => *instr = Instruction::Mov(value, dst.clone()), None => {} }, @@ -506,7 +507,6 @@ impl FnState { | Call(_, _, _) | Apply(_, _, _, _) | Bind(_, _, _) - | Sub(_, _, _) | SubMov(_, _, _) | SubCall(_, _, _, _) | Jmp(_)