Commit 9c15b506 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added a specific edge case that may occasionally remove loops

parent 4f98a38c
...@@ -205,6 +205,8 @@ let optimize program = ...@@ -205,6 +205,8 @@ let optimize program =
(* remove dead code *) (* remove dead code *)
| Set 0 :: Loop _ :: tl -> | Set 0 :: Loop _ :: tl ->
Set 0 :: tl |> opt Set 0 :: tl |> opt
| (Offset (i, Set 0) as off) :: Shift j :: Loop _ :: tl when i = j ->
off :: Shift j :: tl |> opt
| (Shift 0 | Add 0) :: tl | (Shift 0 | Add 0) :: tl
| (Add _ | Set _ | Mul _) :: (Set _ :: _ as tl) -> | (Add _ | Set _ | Mul _) :: (Set _ :: _ as tl) ->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment