never executed always true always false
1 module HelVM.HelMA.Automaton.Optimizer.DeadCodeOptimizer (
2 deadCodeElimination,
3 ) where
4
5 import HelVM.HelMA.Automaton.Instruction
6
7 import HelVM.HelMA.Automaton.Instruction.Extras.Patterns
8
9
10 deadCodeElimination :: InstructionList -> InstructionList
11 deadCodeElimination = fix optimize where
12 optimize :: (InstructionList -> InstructionList) -> InstructionList -> InstructionList
13 optimize f (j@(JumpP _) : il) = j : f (dropWhile (not . isMark) il)
14 optimize f (i : il) = i : f il
15 optimize _ [] = []