Formal semanticsmodels LLVM IR

Vellvm

Also known as Verified LLVM

A formal semantics of LLVM IR in Rocq, with an executable interpreter extracted from the same definitions and used to test the model against clang.

Stage 1 · Validated Written in Rocq (interaction trees) Open source · MIT 3.0.20260707 · 5 months ago

What it covers

Models
LLVM IR, LLVM IR; the parser aims to accept all syntax emitted by Clang 17 or later. The semantics is not tied to one LLVM release.
Fragment
Most of the sequential part of LLVM IR: integers of any width, floats and doubles, structs, arrays, vectors, pointers and integer-pointer casts, poison, global data, recursive functions and some intrinsics. Not covered: concurrency, inline assembly, architecture-specific float types and some instruction annotations. Exception support (invoke, landingpad) is partial.
Written in
Rocq (interaction trees)
Usable in
Rocq
Validation
The interpreter is extracted from the Rocq definitions and compared against clang/llc. The NFM 2025 experience report describes hand-written unit tests, a test suite derived from Alive2, and random differential testing against clang with generated LLVM IR programs (GenLLVM, built on QuickChick) and C programs from Csmith and YARPGen; this found bugs in both Vellvm and clang. Version 3.0 removed the QuickChick dependency. A newer test suite for the LangRef's undefined-behavior rules can be run side by side with clang and the llubi interpreter; Vellvm passed 328 of its 363 assertions as of 2026-10-13.
Maintained by
University of Pennsylvania, with collaborators at Inria

Stage

Computed from the evidence below; see the criteria. MechanizedMechanized. Written in a form a computer can check, rather than on paper. means a computer can check the definition.

Stage 0 Mechanized Met
  • Met: Machine-checked or machine-readable definition Definitions are written in Rocq. evidence
  • Met: Fragment and version are stated The FAQ lists supported and unsupported features and names Clang 17 as the parsing baseline. It does not tie the semantics to a specific LLVM release. evidence
Stage 1 Validated Met
  • Met: Can be executed or tested An interpreter extracted to OCaml runs .ll files. Earlier releases proved it refines the specification; release 3.0 notes that the meta-theory is temporarily unplugged and will be added back. evidence
  • Met: Published results against conformance tests or real implementations Random differential testing against clang/llc, described in the NFM 2025 report, found bugs in both Vellvm and clang. The report gives no pass rates. The undefined-behavior suite (328 of 363 passing) and its comparison script are in the repository. evidence
Stage 2 Authoritative Next
  • Not met: Adopted by the language or ISA owner, or covers the full current version and tracks new ones Adopted by the owner: no; full coverage: no; tracks new versions: no. Not adopted by the LLVM project. In November 2026 the Vellvm authors presented to the LLVM IR Formal Specifications Working Group, which is not an endorsement. Concurrency, inline assembly and some float types are not covered, and exceptions are only partly covered (FAQ, release notes). No stated policy for following new LLVM releases was found in the README, FAQ or website. evidence

Coverage

Which parts of LLVM IR the model defines.

Common features

Common features
FeatureSupportNotes
Machine integers Fixed-width integer arithmetic, overflow and bit operations. SupportedSupported.Integers of any bit width.
Source
Integers of any bit width. source
Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. PartialPartial.float and double are supported. Not supported: architecture-specific float types. Fast-math flags are parsed but do not yet change the semantics.
Source
float and double are supported. Not supported: architecture-specific float types. Fast-math flags are parsed but do not yet change the semantics. source
Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. PartialPartial.A two-phase (infinite, then finite) memory model with provenance and integer-pointer casts (ICFP 2024). Missing (October 2026): UB rules for pointer-access attributes such as noalias, readonly and memory(...), and object bounds for getelementptr inbounds.
Source
A two-phase (infinite, then finite) memory model with provenance and integer-pointer casts (ICFP 2024). Missing (October 2026): UB rules for pointer-access attributes such as noalias, readonly and memory(...), and object bounds for getelementptr inbounds. source
Arrays and buffers Indexed memory such as arrays, slices, vectors and byte buffers. SupportedSupported.Arrays, structs and byte-level loads and stores are modeled.
Source
Arrays, structs and byte-level loads and stores are modeled. source
Loops Unbounded loops, which need invariants or bounds to verify. SupportedSupported.Control-flow graphs with loops, including programs that do not terminate (interaction trees model infinite runs).
Source
Control-flow graphs with loops, including programs that do not terminate (interaction trees model infinite runs). source
Recursion Functions that call themselves, directly or through others. SupportedSupported.Mutually recursive functions are supported.
Source
Mutually recursive functions are supported. source
Higher-order code Function pointers, closures and callbacks. SupportedSupported.Calls through function pointers are modeled, including undefined behavior for calls through null or poison pointers and calling-convention mismatches.
Source
Calls through function pointers are modeled, including undefined behavior for calls through null or poison pointers and calling-convention mismatches. source
Threads and shared memory Concurrent threads with locks, atomics or message passing. Not supportedNot supported.Concurrency is not supported (FAQ). atomicrmw and cmpxchg get a sequential meaning and fence does nothing. A concurrent subset was studied separately (Chappe et al., CPP 2025).
Source
Concurrency is not supported (FAQ). atomicrmw and cmpxchg get a sequential meaning and fence does nothing. A concurrent subset was studied separately (Chappe et al., CPP 2025). source
I/O and system calls Files, network, system calls and foreign-function calls. PartialPartial.Only a few library calls (puts, printf, malloc) are built in. Other external code must be supplied as LLVM IR and linked into the interpreter.
Source
Only a few library calls (puts, printf, malloc) are built in. Other external code must be supplied as LLVM IR and linked into the interpreter. source
Standard library Specifications or models for the language's standard library. PartialPartial.Most of the C standard library is missing. puts, printf and malloc are supported, plus minimal library support in src/libll.
Source
Most of the C standard library is missing. puts, printf and malloc are supported, plus minimal library support in src/libll. source

LLVM IR-specific features

LLVM IR-specific features
FeatureSupportNotes
undef and poison LLVM's deferred undefined behavior values. PartialPartial.Poison is modeled. Since 3.0, undef is treated as poison, following LLVM's plan to remove undef. This differs from today's LangRef in some cases, for example 'or i8 undef, 255' gives poison instead of 255.
Source
Poison is modeled. Since 3.0, undef is treated as poison, following LLVM's plan to remove undef. This differs from today's LangRef in some cases, for example 'or i8 undef, 255' gives poison instead of 255. source
Memory operations alloca, load, store, getelementptr and pointer provenance in LLVM IR. PartialPartial.alloca, load, store, getelementptr, provenance and integer-pointer casts are modeled. Missing: object bounds for getelementptr inbounds, and the attributes that limit what memory a pointer may access.
Source
alloca, load, store, getelementptr, provenance and integer-pointer casts are modeled. Missing: object bounds for getelementptr inbounds, and the attributes that limit what memory a pointer may access. source
Intrinsics LLVM intrinsic functions such as memcpy, overflow checks and bit counts. PartialPartial.Only some intrinsics are covered (for example memcpy, memmove, memset, assume), and users can add more.
Source
Only some intrinsics are covered (for example memcpy, memmove, memset, assume), and users can add more. source
Vector types SIMD vector values and operations. PartialPartial.Fixed-size vectors are modeled and exercised by the random test generator. Scalable vectors are missing: the syntax has no scalable vector type.
Source
Fixed-size vectors are modeled and exercised by the random test generator. Scalable vectors are missing: the syntax has no scalable vector type. source

Used by

Toolchains in this index whose proofs are about this model.

No toolchain in the index refers to it yet.

Sources

esc