Skip to content
UT-InfraAIPublic
forked from AbsInt/CompCert

About

The CompCert formally-verified C compiler

Resources

Stars

3 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

3,432 Commits

Folders and files

Repository files navigation

CompCert

The formally-verified C compiler.

Overview

The CompCert C verified compiler is a compiler for the core C language that generates code for the ARM, PowerPC, RISC-V and x86 processors.

The distinguishing feature of CompCert is that it has been formally verified using the Coq proof assistant: the generated assembly code is formally guaranteed to behave as prescribed by the semantics of the source C code.

For more information on CompCert (supported platforms, supported C features, installation instructions, using the compiler, etc), please refer to the Web site and especially the user's manual.

faster-compcert

This fork tracks faster-compcert, an experiment in closing the performance gap between CompCert and GCC -O2 with new, fully verified optimizations, many of them found, implemented and proved by LLM agents. Details, measurements and the benchmarking harness are in faster-compcert/.

Geomean run time relative to CompCert 3.18 (lower is better). test/c was used for tuning; the other two suites are held out.

compiler test/c big programs PolyBench
CompCert 3.18 1.000 1.000 1.000
gcc -O1 0.893 0.950 0.756
faster-compcert (defaults) 0.831 0.967 0.738
faster-compcert (all opt-in flags) 0.815 0.961 0.733
gcc -O2, restricted to CompCert's semantic model 0.795 0.887 0.648
gcc -O2 0.784 0.886 0.646

Measured 2026-10-25 on a quiet machine, all compilers in one session, with interleaved timing (faster-compcert/results/). "All opt-in flags" adds -fload-op -ftrust-libm. Relative to gcc -O2, faster-compcert is at 1.04-1.06× on test/c, 1.09× on the big programs and 1.13-1.14× on PolyBench; CompCert 3.18 was at 1.28×, 1.13× and 1.55×. See faster-compcert/RETROSPECTIVE.md for the whole project: what was done, where human input was needed, what was automatable, the limitations and blockers, and the roadmap.

Progress so far:

  • Diagnose the gap. The semantic models account for only ~1.5 points of the 22-point gap to gcc -O2; the rest is missing passes and x86 code generation (report).
  • Better inlining heuristic and a second inlining round after constant propagation.
  • More precise dead-store elimination and CSE alias analysis.
  • x86 instruction selection: fused zero-extensions, rotates, division by 2, false-dependency fixes.
  • Global load forwarding across loop back-edges (new pass Loadfwd).
  • Loop-invariant code motion and loop rotation (new passes LICM, Looprot, translation-validated).
  • Held-out evaluation on larger programs and PolyBench (#2).
  • LICM of chains of dependent operations: loop-nest address arithmetic (PolyBench 0.845 → 0.776; #16).
  • Induction-variable widening and strength reduction (new pass IVwiden; PolyBench −4.3%, sha1 −13%; #4).
  • Load-op memory operands on x86, opt-in -fload-op. This is the first approved trusted-base change (#5, ledger).
  • Model x86 shift-count masking (approved trusted-base change, opt-in -fshift-mask; #11).
  • Retroactive review of the round-1 trusted-base changes (#10).
  • Opt-in sqrt/fabs builtins, -ftrust-libm (approved trusted-base change; nbody −17%; #12 phase 1).
  • Zero-extending 8/16-bit loads with 64-bit results, -fzext-load (approved trusted-base change; siphash24 −6%; #25).
  • Unaligned 64-bit accesses and byte-load merging, -fmerge-bytes (approved memory-model change; siphash24 −21%; #13).
  • Pure libm functions (50 functions, -ftrust-libm; approved trusted-base change; perlin −15%; #12 phase 2).
  • Fix the Loadfwd compile-time/memory blow-up on large functions (65 GB → 112 MB on test/abi/layout.c; #19).
  • Reduce the remaining compile-time overhead: first round done (layout.c 11.6 → 6.5 s, spass 54.8 → 46.4 s; CompCert 3.18: 4.9 / 31.3 s); spass is still ~1.5× (#9).

All changes keep CompCert's end-to-end correctness theorem. They add no axioms: the only new assumptions are command-line flags and validated oracles.

License

CompCert is not free software. This non-commercial release can only be used for evaluation, research, educational and personal purposes. A commercial version of CompCert, without this restriction and with professional support and extra features, can be purchased from AbsInt. See the file LICENSE for more information.

Copyright

The CompCert verified compiler is Copyright Institut National de Recherche en Informatique et en Automatique (INRIA) and AbsInt Angewandte Informatik GmbH.

Contact

General discussions on CompCert take place on the compcert-users@inria.fr mailing list.

For inquiries on the commercial version of CompCert, please contact info@absint.com

About

The CompCert formally-verified C compiler

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages