Archive — AoCO2025

December 2025

When compilers surprise you
Sometimes compilers can surprise and delight even a jaded old engineer like me
Switching it up a bit
Taking a look at the various ways the compiler can optimise switch statements
Clever memory tricks
We learn that compilers have tricks to access memory efficiently
When SIMD Fails: Floating Point Associativity
Why floating point maths doesn't vectorise like integers, and what to do about it
SIMD City: Auto-vectorisation
Doing more with less: vectorising can speed your code up 8x or more!
Chasing your tail
The art of not (directly) coming back: tail call optimisation
Partial inlining
Inlining doesn't have to be all-or-nothing
Inlining - the ultimate optimisation
Copy paste can sometimes be a good thing, at least if the compiler does it for you
Calling all arguments
Knowing how compilers call functions can help with design - and optimisation
Aliasing
Knowing when the compiler can't optimise is important too
When LICM fails us
When aliasing can prevent loop-invariant code motion
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.