Archive — AoCO2025

December 2025

Loop-Invariant Code Motion
The compiler can move code outside of loops to speed things up
Unswitching loops for fun and profit
Duplicating loops around can yield some decent optimisations
Pop goes the...population count?
Compilers can take advantage of some very specific instructions
Unrolling loops
Learning when the compiler decides to unroll loops for performance
Induction variables and loops
Compilers can rewrite loops to avoid expensive calculations
Going loopy
Exploring the ways optimisers deal with loop constructs
Multiplying our way out of division
How compilers avoid expensive division with multiplication tricks
Division
Division doesn't have to be slow with some clever tricks
ARM's barrel shifter tricks
The ARM architecture has a cool feature, and compilers know how to use it
Multiplying with a constant
Compilers know all the tricks for avoiding doing actual multiplies.
You can't fool the optimiser
Pattern recognition can see through obfuscated code to find the right instruction
Addressing the adding situation
We learn why adding on x86 isn't as obvious as you might think
Why xor eax, eax?
Why do compilers love xor-ing registers so much?

November 2025

Introducing the Advent of Compiler Optimisations 2025
Announcing AoCO 2025 - daily December posts about compiler optimisations

About Matt Godbolt

Matt Godbolt is a C++ developer living in Chicago. He works for Hudson River Trading on super fun but secret things. He is one half of the Two's Complement podcast. Follow him on Mastodon or Bluesky.