Skip to content

Commit

Permalink
Eliminate x = x assignments.
Browse files Browse the repository at this point in the history
  • Loading branch information
valderman committed Jul 31, 2015
1 parent ed88ed8 commit 2486391
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Data/JSTarget/Optimize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ tryTernary _ _ _ _ _ =
-- | Remove bogus assignments of the form @literal = exp@, which may arise from
-- other optimizations.
removeNonsenseAssigns :: Stm -> Stm
removeNonsenseAssigns (Assign (LhsExp _ (Lit _)) _ next) = next
removeNonsenseAssigns stm = stm
removeNonsenseAssigns (Assign (LhsExp _ (Lit _)) _ next) = next
removeNonsenseAssigns (Assign (LhsExp _ a) b next) | a == b = next
removeNonsenseAssigns stm = stm

-- | How many times does an expression satisfying the given predicate occur in
-- an AST (including jumps)?
Expand Down

0 comments on commit 2486391

Please sign in to comment.