[#300] Reapply optimizer stages until fixpoint
Description
Problem: optimizer doesn't revisit nodes, hence while there might be new optimization opportunities lower in the AST uncovered by optimizations higher in the AST, optimizer won't see those.
Solution: A bit ad-hoc, but at least it's simple. Reapply each optimizer stage until the output stops changing, up to a maximum number of iterations (to avoid going into infinite loops with contradictory rules; our default rules apparently aren't, but since we allow extending the ruleset, it seems like a good idea to do this)
Problem: Meta and WithLoc wrappers preclude some optimizations and those aren't meaningful for the optimized contract anyway.
Solution: Drop these wrappers during optimization.
Related issue(s)
Resolves #300 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.