Skip to content

Commit

Permalink
Expr: add division simplification (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoep authored Oct 11, 2023
1 parent bec4c44 commit 15fe3d0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/EVM/Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ simplify e = if (mapExpr go e == e)
-- Some trivial div eliminations
go (Div (Lit 0) _) = Lit 0 -- divide 0 by anything (including 0) is zero in EVM
go (Div _ (Lit 0)) = Lit 0 -- divide anything by 0 is zero in EVM
go (Div a (Lit 1)) = a

-- If a >= b then the value of the `Max` expression can never be < b
go o@(LT (Max (Lit a) _) (Lit b))
Expand Down

0 comments on commit 15fe3d0

Please sign in to comment.