IT lexicon › Programming › MemorySSA

MemorySSA

Programming På svenska → Updated: 2026-11-05

SSA form for memory: every store creates a new version of "memory", so the compiler can ask which write a given load actually sees.

Ordinary SSA makes the path from use to definition trivial for local variables but says nothing about *p. MemorySSA treats all of memory as a single variable. Each store becomes a MemoryDef, each load a MemoryUse, and where paths merge a MemoryPhi appears. Alias analysis then refines the chain, so a load can skip past stores that provably touch other addresses.

The idea goes back to Fred Chow and colleagues at SGI in 1996. GCC has had its virtual operands since tree-ssa landed in 4.0, and LLVM got MemorySSA around 2016. There it replaced slow queries that crawled backwards one instruction at a time, and it now drives dead store elimination, loop-invariant code motion and parts of GVN.

← Back to the lexicon