Alive2
Also known as alive-tv, alivecc
Automatically checks that an optimized LLVM IR function still behaves like the original, or shows a counterexample. Loops are checked only up to a set bound.
Use it if
- You write or review LLVM optimizations and want each rewrite checked, or a concrete counterexample, within seconds.
- You want to compare two versions of the same LLVM IR function, for example a hand-optimized one against a reference.
Look elsewhere if
- You need a proof that holds for loops of any length. Alive2 only explores loop iterations up to a bound you choose.
- You want to prove a program meets a written specification, or check code that uses atomics or threads.
- Your transformation moves code between functions. Alive2 checks one function at a time.
How it works
From your code to an accepted proof. Each step either has to be trusted or is checked by something else.
- Input LLVM IR code
- Front end LLVM IR parser and Alive2's LLVM-to-Alive2 IR converter Trusted LLVM's own library parses textual and bitcode IR; Alive2's converter (llvm2alive) then turns it into Alive2's internal IR. The PLDI 2021 paper lists both as part of the trusted base.
- Semantics Alive2 SMT encoding of LLVM IR Trusted Alive2's own model of LLVM IR (undef, poison, memory) written as SMT formulas. It is separate from Vellvm.
- Translation Alive2 symbolic executor and refinement check Trusted Unrolls loops up to the chosen bound and builds the refinement queries.
- Checker Z3 Trusted
- Compiler LLVM backend (llc) Trusted Not checked by Alive2. Alive2 only covers IR-to-IR steps.
Verified or checked: outside the trusted base Validated per run or by tests Trusted without proof
- LLVM IR: Checks that a target (optimized) function refines a source function, one function at a time. Interprocedural transformations are not supported (README).
Trust
What a proof from this toolchain relies on: the trusted computing baseTrusted computing base (TCB). Everything that must be correct for a proof to mean what it says., one part at a time. How these are rated.
- Checker What has the final word on a proof?Partial
Z3 decides refinement; no proof certificates. Results hold only up to the loop bound.
The PLDI 2021 paper names Alive2 itself, Z3 and LLVM's IR parser as the trusted base. The authors found six soundness bugs in Z3 while building Alive2 (BugList.md now lists 24 Z3 bugs). Results print as 'seems to be correct'.
- Semantics Is the tool's model of the language the real language?Partial
Alive2's own SMT model of LLVM IR; run on LLVM's tests, but no published validation.
The work led to eight patches to the LLVM Language Reference, but the encoding is not the official reference, and no published validation against LLVM's behavior was found.
- Frontend How does your source get into the model?Strong
LLVM's own IR parser reads the code; Alive2's converter to its internal IR is trusted.
- Binary gap Does the proof cover what actually runs?Weak
Covers IR-to-IR optimizations only; machine code from LLVM's backend is not checked.
arm-tv (OOPSLA 2025) is a separate research tool built on Alive2 that checks LLVM's AArch64 backend. It is not part of the Alive2 tools described in the README.
- Escape hatches Can a proof silently rest on unchecked assumptions?Partial
Approximations and timeouts are reported; the loop bound and input flags are not.
When a counterexample depends on an over-approximated feature, Alive2 prints 'Couldn't prove the correctness' and lists the approximations. Timeouts and unsupported instructions are reported as errors. The loop bound and flags such as -disable-undef-input appear only in the command line.
What it can prove
Kinds of guarantees, not how easy they are to get.
| Feature | Support | Notes |
|---|---|---|
| No undefined behavior Memory safety and absence of runtime errors: no out-of-bounds access, use-after-free, overflow traps, panics or undefined behavior on any input allowed by the precondition. | Not supportedNot supported.Alive2 does not prove that a program is free of undefined behavior. Its refinement check only guarantees that the optimized version has no undefined behavior the original lacked. Source | Alive2 does not prove that a program is free of undefined behavior. Its refinement check only guarantees that the optimized version has no undefined behavior the original lacked. source |
| Functional correctness The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”. | Not supportedNot supported.No specification language. The closest substitute is writing a reference version in LLVM IR and checking equivalence against it. | No specification language. The closest substitute is writing a reference version in LLVM IR and checking equivalence against it. |
| Equivalence Two programs (an optimized and a reference version, or code before and after a change) are proved to behave the same, or one refines the other. | SupportedSupported.This is Alive2's main job: it checks that the target refines the source (it may be more defined, never less). Within the loop bound and without timeouts, a pass is a proof for that one pair of functions. Source | This is Alive2's main job: it checks that the target refines the source (it may be more defined, never less). Within the loop bound and without timeouts, a pass is a proof for that one pair of functions. source |
| Information flow Secrets do not influence public outputs, timing or memory access patterns (constant-time code, non-interference). | Not supportedNot supported.No support for secrecy or constant-time properties. | No support for secrecy or constant-time properties. |
| Concurrency Correctness of code with threads or shared memory: absence of data races, deadlock freedom, linearizability of concurrent data structures. | Not supportedNot supported.Atomic and volatile loads and stores, atomicrmw, cmpxchg and fence are rejected as unsupported by the LLVM-to-Alive2 converter. Source | Atomic and volatile loads and stores, atomicrmw, cmpxchg and fence are rejected as unsupported by the LLVM-to-Alive2 converter. source |
| Termination and liveness Every run finishes, or the system keeps making progress (liveness). | Not supportedNot supported.Termination is not checked. Only paths that reach a return are compared, and infinite loops without the mustprogress attribute are unsupported. Source | Termination is not checked. Only paths that reach a return are compared, and infinite loops without the mustprogress attribute are unsupported. source |
Language coverage
Which parts of LLVM IR it handles. Hover or focus a mark for details.
Common features
| Feature | Support | Notes |
|---|---|---|
| Machine integers Fixed-width integer arithmetic, overflow and bit operations. | SupportedSupported.Integers are encoded as SMT bit-vectors, including the nsw/nuw overflow flags. Source | Integers are encoded as SMT bit-vectors, including the nsw/nuw overflow flags. source |
| Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. | PartialPartial.IEEE-754 operations map to SMT floating-point theory (half, bfloat, float, double, fp128). Not supported: x86 80-bit and PowerPC double-double types. The 2021 paper notes that LLVM's frem rounds differently from SMT's remainder. Source | IEEE-754 operations map to SMT floating-point theory (half, bfloat, float, double, fp128). Not supported: x86 80-bit and PowerPC double-double types. The 2021 paper notes that LLVM's frem rounds differently from SMT's remainder. source |
| Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. | PartialPartial.Byte-level memory model with blocks and pointer provenance (CAV 2021 encoding). The 2021 paper's stated limitation: it assumes calls do not modify local variables whose address has escaped. Volatile and atomic accesses are unsupported. Source | Byte-level memory model with blocks and pointer provenance (CAV 2021 encoding). The 2021 paper's stated limitation: it assumes calls do not modify local variables whose address has escaped. Volatile and atomic accesses are unsupported. source |
| Arrays and buffers Indexed memory such as arrays, slices, vectors and byte buffers. | SupportedSupported.Memory blocks are modeled as SMT arrays of bytes, so arrays and buffers are supported. Source | Memory blocks are modeled as SMT arrays of bytes, so arrays and buffers are supported. source |
| Loops Unbounded loops, which need invariants or bounds to verify. | PartialPartial.Loops are unrolled up to a bound (-src-unroll and -tgt-unroll). The default bound is 0: any jump back to an already visited block is cut, so only paths that never repeat a loop body are compared. Bugs that need more iterations are missed. Source | Loops are unrolled up to a bound (-src-unroll and -tgt-unroll). The default bound is 0: any jump back to an already visited block is cut, so only paths that never repeat a loop body are compared. Bugs that need more iterations are missed. source |
| Recursion Functions that call themselves, directly or through others. | PartialPartial.Each function is checked on its own, and calls (recursive or not) are treated as calls to an unknown function. Transformations that change behavior across function boundaries are not supported. Source | Each function is checked on its own, and calls (recursive or not) are treated as calls to an unknown function. Transformations that change behavior across function boundaries are not supported. source |
| Higher-order code Function pointers, closures and callbacks. | PartialPartial.Current code translates indirect calls through function pointers as calls to unknown functions. The 2021 paper still listed function pointers as unsupported. No source found on how precisely the target function is tracked. Source | Current code translates indirect calls through function pointers as calls to unknown functions. The 2021 paper still listed function pointers as unsupported. No source found on how precisely the target function is tracked. source |
| Threads and shared memory Concurrent threads with locks, atomics or message passing. | Not supportedNot supported.Atomic instructions and fences are rejected as unsupported. Source | Atomic instructions and fences are rejected as unsupported. source |
| I/O and system calls Files, network, system calls and foreign-function calls. | PartialPartial.External calls are modeled as unknown functions that may change any memory. The 2021 paper names missing semantics for some string and I/O library functions as a common reason functions were skipped. Source | External calls are modeled as unknown functions that may change any memory. The 2021 paper names missing semantics for some string and I/O library functions as a common reason functions were skipped. source |
| Standard library Specifications or models for the language's standard library. | PartialPartial.As of the 2021 paper, 117 C library functions had special semantics, some only partly. Others are treated as unknown calls. Source | As of the 2021 paper, 117 C library functions had special semantics, some only partly. Others are treated as unknown calls. source |
LLVM IR-specific features
| Feature | Support | Notes |
|---|---|---|
| undef and poison LLVM's deferred undefined behavior values. | PartialPartial.Poison and undef are both modeled. But function inputs are either fully undef or fully defined: partly-undef inputs (some bits undef) are not explored, so some bugs can be missed. The -disable-undef-input and -disable-poison-input flags narrow this further. Source | Poison and undef are both modeled. But function inputs are either fully undef or fully defined: partly-undef inputs (some bits undef) are not explored, so some bugs can be missed. The -disable-undef-input and -disable-poison-input flags narrow this further. source |
| Memory operations alloca, load, store, getelementptr and pointer provenance in LLVM IR. | PartialPartial.alloca, load, store, getelementptr and provenance are modeled. Not supported: volatile and atomic accesses. The 2021 paper also left out type-based alias analysis, and assumed calls never change local variables whose address was passed out. Source | alloca, load, store, getelementptr and provenance are modeled. Not supported: volatile and atomic accesses. The 2021 paper also left out type-based alias analysis, and assumed calls never change local variables whose address was passed out. source |
| Intrinsics LLVM intrinsic functions such as memcpy, overflow checks and bit counts. | PartialPartial.In 2021, 54 of 258 platform-independent intrinsics (21%) had semantics; current code also models some x86 intrinsics. Others are over-approximated as unknown calls, and Alive2 says so when that blocks a verdict. Source | In 2021, 54 of 258 platform-independent intrinsics (21%) had semantics; current code also models some x86 intrinsics. Others are over-approximated as unknown calls, and Alive2 says so when that blocks a verdict. source |
| Vector types SIMD vector values and operations. | PartialPartial.Fixed-width vectors are supported. Scalable vectors are checked only for one fixed vscale value (2 by default). Source | Fixed-width vectors are supported. Scalable vectors are checked only for one fixed vscale value (2 by default). source |
Stage
Computed from the evidence below; see the criteria. 1criterion is missing for Stage 2.
- Met: Released or updated in the last 12 months Latest release: v21.0, 2025-08-12. Latest commit: 2026-11-16. evidence
- Met: Installs and runs on current platforms CI builds on Ubuntu 24.04 and macOS 15 against current LLVM. The latest tagged release (v21.0) is from August 2025, but the master branch is active (commit 3bdd4f5, 2026-11-16) and is meant to be built against LLVM's main branch. evidence
- Met: User documentation or tutorial README with build and usage instructions, plus a web version at alive2.llvm.org. evidence
- Met: Used by a group other than its authors LLVM's InstCombine contributor guide tells contributors to include Alive2 proofs in pull requests. evidence
- Not met: Verified code in production at two or more independent organizations 1 recorded: LLVM project.
- Met: Checker axis is not red
- Met: Semantics axis is not red
- Met: Public channel for soundness bugs Public GitHub issue tracker. evidence
In use
Verified code in production, and notable verification projects.
In production
- LLVM project The InstCombine contributor guide says pull requests should contain Alive2 proofs of each proposed transform. source
Projects
- Daily translation validation of LLVM's unit tests — README: run on LLVM's main branch each day, results tracked on this page.
- List of LLVM and Z3 bugs found by Alive2 — 101 LLVM bugs and 24 Z3 bugs listed as of 2026-11-26.
- arm-tv translation validation for LLVM's AArch64 backend (OOPSLA 2025)
Facts and sources
- Effort
- Push-button: Run it on your code; little or no annotation.
- Licence
- Open source, MIT
- Maintained by
- Nuno P. Lopes (INESC-ID / Instituto Superior Técnico) and contributors
- Latest release
- v21.0 (12 Aug 2025) source
- Last checked
- 26 Nov 2026
Further sources
- Alive2 README · accessed 26 Nov 2026
- Alive2: Bounded Translation Validation for LLVM (PLDI 2021) · accessed 26 Nov 2026
- Alive2 command-line options and defaults · accessed 26 Nov 2026
- Alive2 LLVM-to-Alive2 IR converter · accessed 26 Nov 2026
- Alive2 refinement check and error reporting · accessed 26 Nov 2026
- Alive2 symbolic state (back edges go to the sink block) · accessed 26 Nov 2026
- LLVM InstCombine contributor guide · accessed 26 Nov 2026
- Translation Validation for LLVM's AArch64 Backend (OOPSLA 2025) · accessed 26 Nov 2026
- Alive2 releases · accessed 26 Nov 2026