# Alive2

> 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.

- Kind: toolchain
- Verifies: LLVM IR (Checks that a target (optimized) function refines a source function, one function at a time. Interprocedural transformations are not supported (README).)
- Effort: Push-button — Run it on your code; little or no annotation.
- Stage: 1 (Usable)
- Trust: Checker partial, Semantics partial, Frontend strong, Binary gap weak, Escape hatches partial
- Licence: open-source, MIT
- Latest release: v21.0 (2025-08-12) https://github.com/AliveToolkit/alive2/releases/tag/v21.0
- Latest commit: 2026-11-16 https://github.com/AliveToolkit/alive2/commits/master
- Links: [homepage](https://alive2.llvm.org/ce/), [repo](https://github.com/AliveToolkit/alive2), [docs](https://github.com/AliveToolkit/alive2/blob/master/README.md), [paper](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)

## 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 (pipeline)

| Step | Component | Assurance | Note |
|---|---|---|---|
| frontend | 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 (`z3`) | trusted |  |
| compiler | LLVM backend (llc) | trusted | Not checked by Alive2. Alive2 only covers IR-to-IR steps. |

## Trust

| Axis | Level | Summary | Note |
|---|---|---|---|
| Checker | Partial (amber) | 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'. [source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf) |
| Semantics | Partial (amber) | 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. [source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf) |
| Frontend | Strong (green) | LLVM's own IR parser reads the code; Alive2's converter to its internal IR is trusted. |  [source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf) |
| Binary gap | Weak (red) | 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. [source](https://2025.splashcon.org/details/OOPSLA/169/Translation-Validation-for-LLVM-s-AArch64-Backend) |
| Escape hatches | Partial (amber) | 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. [source](https://github.com/AliveToolkit/alive2/blob/master/tools/transform.cpp) |

## What it can prove

| Property | Support |
|---|---|
| No undefined behavior | Not 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Functional correctness | Not supported — No specification language. The closest substitute is writing a reference version in LLVM IR and checking equivalence against it. |
| Equivalence | Supported — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Information flow | Not supported — No support for secrecy or constant-time properties. |
| Concurrency | Not supported — Atomic and volatile loads and stores, atomicrmw, cmpxchg and fence are rejected as unsupported by the LLVM-to-Alive2 converter. ([source](https://github.com/AliveToolkit/alive2/blob/master/llvm_util/llvm2alive.cpp)) |
| Termination and liveness | Not supported — Termination is not checked. Only paths that reach a return are compared, and infinite loops without the mustprogress attribute are unsupported. ([source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |

## Common features

| Feature | Support |
|---|---|
| Machine integers | Supported — Integers are encoded as SMT bit-vectors, including the nsw/nuw overflow flags. ([source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Floating point | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Heap and pointers | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Arrays and buffers | Supported — Memory blocks are modeled as SMT arrays of bytes, so arrays and buffers are supported. ([source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Loops | Partial — 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](https://github.com/AliveToolkit/alive2/blob/master/llvm_util/cmd_args_list.h)) |
| Recursion | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Higher-order code | Partial — 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](https://github.com/AliveToolkit/alive2/blob/master/llvm_util/llvm2alive.cpp)) |
| Threads and shared memory | Not supported — Atomic instructions and fences are rejected as unsupported. ([source](https://github.com/AliveToolkit/alive2/blob/master/llvm_util/llvm2alive.cpp)) |
| I/O and system calls | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Standard library | Partial — As of the 2021 paper, 117 C library functions had special semantics, some only partly. Others are treated as unknown calls. ([source](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |

## LLVM IR-specific features

| Feature | Support |
|---|---|
| undef and poison | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Memory operations | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Intrinsics | Partial — 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](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)) |
| Vector types | Partial — Fixed-width vectors are supported. Scalable vectors are checked only for one fixed vscale value (2 by default). ([source](https://github.com/AliveToolkit/alive2/blob/master/util/config.cpp)) |

## Stage

**Stage 1: Usable.**

| Stage | Criterion | Met | Evidence / note |
|---|---|---|---|
| 0 | Publicly available | yes | [evidence](https://github.com/AliveToolkit/alive2) |
| 0 | At least one published verification uses it | yes | [evidence](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf) PLDI 2021 paper: run over LLVM's unit tests, 47 new LLVM bugs reported. |
| 1 | Released or updated in the last 12 months | yes | [evidence](https://github.com/AliveToolkit/alive2/commits/master) Latest release: v21.0, 2025-08-12. Latest commit: 2026-11-16. |
| 1 | Installs and runs on current platforms | yes | [evidence](https://github.com/AliveToolkit/alive2/actions/workflows/build.yml) 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. |
| 1 | User documentation or tutorial | yes | [evidence](https://github.com/AliveToolkit/alive2/blob/master/README.md) README with build and usage instructions, plus a web version at alive2.llvm.org. |
| 1 | Used by a group other than its authors | yes | [evidence](https://llvm.org/docs/InstCombineContributorGuide.html) LLVM's InstCombine contributor guide tells contributors to include Alive2 proofs in pull requests. |
| 2 | Verified code in production at two or more independent organizations | no | 1 recorded: LLVM project. |
| 2 | Checker axis is not red | yes |  |
| 2 | Semantics axis is not red | yes |  |
| 2 | Public channel for soundness bugs | yes | [evidence](https://github.com/AliveToolkit/alive2/issues) Public GitHub issue tracker. |

Missing for Stage 2: Verified code in production at two or more independent organizations.

## In production
- LLVM project: The InstCombine contributor guide says pull requests should contain Alive2 proofs of each proposed transform. ([source](https://llvm.org/docs/InstCombineContributorGuide.html))

## Projects
- [Daily translation validation of LLVM's unit tests](https://web.ist.utl.pt/nuno.lopes/alive2/) — README: run on LLVM's main branch each day, results tracked on this page.
- [List of LLVM and Z3 bugs found by Alive2](https://github.com/AliveToolkit/alive2/blob/master/BugList.md) — 101 LLVM bugs and 24 Z3 bugs listed as of 2026-11-26.
- [arm-tv translation validation for LLVM's AArch64 backend (OOPSLA 2025)](https://2025.splashcon.org/details/OOPSLA/169/Translation-Validation-for-LLVM-s-AArch64-Backend)

## Sources
- [Alive2 README](https://github.com/AliveToolkit/alive2/blob/master/README.md)
- [Alive2: Bounded Translation Validation for LLVM (PLDI 2021)](https://web.ist.utl.pt/nuno.lopes/pubs/alive2-pldi21.pdf)
- [Alive2 command-line options and defaults](https://github.com/AliveToolkit/alive2/blob/master/llvm_util/cmd_args_list.h)
- [Alive2 LLVM-to-Alive2 IR converter](https://github.com/AliveToolkit/alive2/blob/master/llvm_util/llvm2alive.cpp)
- [Alive2 refinement check and error reporting](https://github.com/AliveToolkit/alive2/blob/master/tools/transform.cpp)
- [Alive2 symbolic state (back edges go to the sink block)](https://github.com/AliveToolkit/alive2/blob/master/ir/state.cpp)
- [LLVM InstCombine contributor guide](https://llvm.org/docs/InstCombineContributorGuide.html)
- [Translation Validation for LLVM's AArch64 Backend (OOPSLA 2025)](https://2025.splashcon.org/details/OOPSLA/169/Translation-Validation-for-LLVM-s-AArch64-Backend)
- [Alive2 releases](https://github.com/AliveToolkit/alive2/releases)

---
Last checked 2026-11-26. Data: [JSON](/toolchains/alive2.json) · Page: [HTML](/toolchains/alive2/) · Methodology v0.1: [/methodology/](/methodology/) · Corrections: [/contribute/](/contribute/)
