Twelve Pieces to Read Before the Compiler Interview
Published: October 15, 2026 | Careers & Interviews Compilers & Toolchains
Twelve Pieces to Read Before the Compiler Interview
You are optimizing a hot path. The profiler says a tight loop is being unrolled into something that no longer fits in the instruction cache. So you write #pragma clang loop unroll(disable), recompile, and open the assembly.
The loop is still unrolled.
That is the compiler segment in four lines, and it is the segment candidates handle with the most misplaced confidence. Everyone knows what -O3 means. Very few have watched a compiler ignore an instruction, or can say which of the twenty passes between their source and their assembly is the one that made the decision they are unhappy about. The survival map treats codegen questions as high-signal for that reason. The answer is checkable, and almost nobody has checked.
Twelve bodies of work, in four groups. What the compiler does to your loop, how to audit its work, what happens when you build the compiler itself, and how fast the ground moves underneath a pinned toolchain. Member links are marked and unpublished pieces carry their date.
What it does to your loop
When compilers won't listen
Part 1 (members), Part 2 (members), Part 3 (members), Part 4 (members).
Six months of loop transformations that did not do what the pragma said, written up as a four-part fight. The unrolling pragma is the entry point and the general finding is broader: several of the knobs the documentation offers are hints the optimizer is free to decline, and the documentation does not distinguish the hints from the instructions.
The reason this leads the list is that it inverts the mental model most candidates hold, which is that the compiler is a machine you configure. It is closer to a compiler you negotiate with, and the negotiation happens in the assembly output.
In the room: name a pragma or attribute your compiler ignored, and how you found out.
GCC 14 turned your computed goto back into a switch
Read it (15 Oct).
The folklore is old and well founded. A switch loop has one indirect branch with twenty-six targets and the predictor cannot learn it, so you write computed goto and give the predictor one site per handler with simpler history at each. CPython moved to goto * in 2008 for this, and the 3.14 team rewrote the interpreter as 225 [[clang::musttail]] functions.
On a FIX 4.4 field scanner with twenty-six handlers, identical bodies and only the dispatch varying, GCC 14 undoes the transformation and converges the computed goto back into a switch. musttail does not let it. The folklore is right about the hardware and wrong about whether your compiler will let you express it.
In the room: how would you prove your interpreter dispatch is doing what you wrote.
Finding the loops your compiler silently skips
Irreducible control flow is a vectorization cliff and nothing in the build tells you when you have fallen off it. No warning, no remark at the default settings, just a loop that stayed scalar while the ones around it did not.
In the room: how do you know which of your loops vectorized, without reading every disassembly.
Early exit kills the vectorizer
Read it (9 Oct).
A search loop with a break in it does not vectorize, which everybody knows, and GCC 14 shipped early-break support, which most people took to mean the problem was solved. It is not solved for the shapes that show up in market data parsing, and the piece walks the specific conditions under which the new support declines to fire.
In the room: your loop has a data-dependent exit. What are the options, and what does each cost.
Auditing its work
How we filed a real LLVM bug
A trading desk lost twenty-three percent of its p99 budget and a confident Substack post explained why, naming three culprits: cmov chosen wrongly, transparent huge pages misconfigured, and a lock-free queue with the wrong topology. We tried to reproduce one claim, the cmov one, which held that a predictable branch beats cmov above about 95 percent accuracy with break-even near 75.
Chasing it produced a real bug report against LLVM. This is the best single demonstration on the list of the difference between having an opinion about codegen and having a reproducer, and filing the bug is the part that makes it evidence.
In the room: you disagree with the code the compiler emitted. What do you do next.
You can beat the compiler, llvm-mca tells you when
Read it (26 Sep).
Hand-written assembly beating -O3 is real, and OpenSSL, glibc and ffmpeg all ship it. The part left out of the claim is that nobody has beaten a modern out-of-order core by staring at instructions since the Pentium Pro. The hand-tuning that works is a feedback loop and the feedback comes from an instrument.
So the piece cross-examines the instrument rather than demonstrating it. Three hot-loop kernels on three microarchitectures: llvm-mca was right about the first, wrong on the newest chip about the second, and blind about the third. I did not chase why the newest part is where it degrades, though the obvious guess is that the scheduling model lags the silicon.
In the room: how much of what a static analyser tells you about a loop do you believe, and which parts.
The hidden performance killers in inline assembly
Part 1 (members), Part 2 (members).
Inline assembly is the escape hatch every HFT codebase has somewhere, and the constraint syntax is where it goes wrong quietly. A wrong clobber list or a missing memory constraint does not produce an error, it produces code that works until the surrounding function changes.
In the room: what happens if you forget the memory clobber, and when would you notice.
Building the compiler and the binary
The great position-independent code scam
Part 1 (members), Part 2 (members), Part 3 (members).
Sun convinced the industry to accept roughly a 20 percent penalty to solve a problem that did not need to exist, and thirty-five years later every function call and every global access in a shared library still pays it. Part 2 connects it to the security hardening that made it mandatory, and part 3 is how to get out from under it.
The opinion in that first sentence is mine and it is stronger than most people are comfortable with. The measurements are in the pieces, which is the only reason to state it that way.
In the room: what does -fPIC cost you, and under what linking model can you avoid paying it.
BOLT after PGO
We ran BOLT on top of a PGO-optimized clang and watched it make the compiler 25 to 35 percent slower, and published the blunt advice that on AMD you should skip BOLT. That advice was correct and misleading at the same time. BOLT regressed because the Zen 2 box could not feed it the branch records it needs. On a Zen 5 part, same binary and same recipe, the regression becomes a small repeatable win.
Correcting our own published advice in public is the reason this is on the list. An interviewer who asks what you got wrong recently is asking for exactly this shape of answer.
In the room: what does BOLT need from the hardware, and how would you check your box provides it.
Your distro already PGO'd your compiler
Read it (members).
A replication and extension of peter0x44's super-gcc work on HFT-shaped C++ workloads. Zen 2 build host, three runs per cell, 146 verified measurements, and the predictions written down and locked before any of them ran.
The framing is the useful part for a candidate. Twenty engineers losing fifteen minutes a day to compile waits is a senior salary a year, which turns build time from a developer-comfort question into a budget question, and that reframe travels well in an interview.
In the room: how much of your build time is the compiler and how much is your own headers.
The ground moving under a pinned toolchain
GCC 16 vs GCC 14 on the gold submissions
Read it (members).
The gold-badge audit had produced a language claim: 23 of 24 winning solutions compile at C++11, none of the C++20 marquee features were load-bearing, and the cycles came from SIMD intrinsics, GCC builtins and alignas(64). This piece asks the compiler version of the same question by putting those submissions through two GCC generations to see what moved without anybody touching the source.
In the room: when you bumped compiler versions, what got faster and what got slower.
glibc's cleanup year
Read it (members).
Deleting twenty years of accumulated code out of glibc changed performance for programs whose authors did nothing. This is the layer below the compiler that candidates almost never mention, and memcpy dispatch alone accounts for more variation across distributions than most people expect.
In the room: your binary got faster after an OS upgrade and you changed nothing. Where would you look.
The questions, and where each is answered
| the question | the piece |
|---|---|
| Which pragma did your compiler ignore? | When compilers won't listen |
| How do you prove your dispatch is what you wrote? | GCC 14 turned your computed goto back into a switch |
| Which of your loops vectorized? | Finding the loops your compiler silently skips |
| Your loop has a data-dependent exit. Options? | Early exit kills the vectorizer |
| You disagree with the emitted code. Next step? | How we filed a real LLVM bug |
| How much of a static analyser do you believe? | You can beat the compiler, llvm-mca tells you when |
| What happens if you forget the memory clobber? | Hidden performance killers in inline assembly |
| What does -fPIC cost you? | The great position-independent code scam |
| What does BOLT need from the hardware? | BOLT after PGO |
| How much of your build is the compiler? | Your distro already PGO'd your compiler |
| What moved when you bumped compiler versions? | GCC 16 vs GCC 14 on the gold submissions |
| Faster after an OS upgrade, no source change. Why? | glibc's cleanup year |
Where this list is thin
It is a GCC and Clang list. MSVC appears nowhere, which is defensible for a low-latency audience running Linux and indefensible if you are interviewing anywhere that ships on Windows.
It also has nothing on link-time optimization as a subject in its own right, despite LTO showing up as a supporting character in half the entries. That gap is real, and the reason is that our LTO results have been inconsistent enough across projects that I have not been able to write a piece I would stand behind. I would rather say that than publish the version with the caveats sanded off.
Earlier parts: concurrency, microarchitecture, benchmarking, and the language.
Review quiz
Five questions about this article. Get four right and it counts as read. Review quizzes come with a membership.
Log in See membership
Comments
No comments yet. Be the first to share your thoughts.