Get the latest tech news

Abstract Interpretation in the Toy Optimizer


CF Bolz-Tereick wrote some excellent posts in which they introduce a small IR and optimizer and extend it with allocation removal. We also did a live stream together in which we did some more heap optimizations.

In this blog post, I’m going to write a small abtract interpreter for the Toy IR and then show how we can use it to do some simple optimizations. There’s rigorous mathematical formalism thanks to Patrick and Radhia Cousot, our favorite power couple, and there’s also sketchy hand-wavy stuff like what will follow in this post. To do some abstract interpretation on this program, we’ll need to implement the transfer functions for lshift and add( dummy will just always return TOP).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of toy optimizer

toy optimizer