← Back to Home

IR Optimization

Making Code Faster and Smaller

Mathematical Intelligence

Because we use a "dumb" Code Generator that blindly translates lines 1-to-1 into assembly, we have to make our code "smart" during the IR phase. Optimization passes analyze the IR instructions and rewrite them to be more efficient without changing the final output of the program.

Our Optimization Passes

Interactive Optimizer Simulator

Click through the optimization passes below. Notice how propagation and folding have a cascading effect, creating unused "dead code" that we can delete at the very end!

Optimization Passes

IR State