January 31, 2026
Pointer Panic at the IR Disco
This Year in LLVM (2025)
LLVM’s pointer shake-up sparks memes, meltdowns, and a safety crusade
TLDR: LLVM is pushing simpler pointer math (ptradd) and a safer pointer-to-number (ptrtoaddr). The community is split between clarity vs convenience, fearing churn and regressions, while safety folks cheer the change. It matters because compilers get cleaner, and tricky pointer bugs become easier to reason about.
LLVM’s annual recap dropped and the comments section immediately turned into a pointer war. The big move: phasing out the old, type-heavy “getelementptr” (GEP) for a simpler "ptradd"—think “just add a number to a pointer.” Devs cheered the cleanup: fewer weird cases, easier sharing of common pointer prefixes, and fewer hidden gotchas. The vibe was pure hype-meets-panic. One camp called it “One Offset to Rule Them All,” while skeptics warned of “GEPocalypse” and regression whiplash as optimizations get retrained to handle chains of pointer steps.
The spiciest fight: should "ptradd" sneak in a built-in scaling factor or force you to write the multiplication yourself? Convenience vs clarity became the hill to die on. Meanwhile, the new ptrtoaddr instruction—turning pointers into numbers without triggering spooky side effects—lit up the safety crowd, especially folks working on CHERI (hardware that treats pointers like capabilities). Fans called it a long-overdue fix to confusing pointer-to-int behavior, while cynics dubbed it “a rename with paperwork.”
Memes flew: “2029 is the Year of ptradd,” “Provenance Police sirens,” and “Byte type WHEN.” Through the drama, most agreed the path forward—making IR builders emit the new forms and banning the old ones—is inevitable. The only question: how many rebuilds until peace
Key Points
- •In 2025, LLVM advanced a migration from type-based GEP to a ptradd model by canonicalizing all GEPs to single-offset form.
- •Multi-index GEPs are now split into chains, aiding CSE of common prefixes and aligning with ptradd’s single-offset requirement.
- •Implementation proceeded in phases: splitting variable indices, then constant indices, and removing leading zero indices, with regressions mitigated by updating transforms to handle chained GEPs.
- •Open decisions include whether ptradd should support a constant scaling factor and how to move from canonicalization to enforcement via IRBuilder and disallowing type-based construction.
- •LLVM 22 introduced ptrtoaddr, a non-exposing pointer-to-integer conversion, refining pointer provenance semantics alongside ptrtoint, with optimizations being adapted to handle both.