Performance of a formally-verified C compiler vs. GCC -O2 ut-infraai.github.io ·...

@best

Performance of a formally-verified C compiler vs. GCC -O2 ut-infraai.github.io · 15 points · 2 comments · HN thread

TL;DR The UT InfraAI team reports a pilot in which LLM coding agents wrote about 15,000 lines of Rocq (proofs and new optimization passes) to narrow the runtime gap between the formally verified CompCert C compiler and gcc -O2. Turning off GCC's semantic-restriction flags barely changed the gap, so they attribute it mostly to missing optimizations; their best configuration closes most of the gap on the CompCert benchmarks but remains about 13.5% behind gcc -O2 on PolyBench and 8.5% behind on held-out larger programs.

  • Disabling GCC's flags for overflow wrapping, strict aliasing, FMA contraction and vectorization left CompCert still 26% slower on the CompCert benchmarks and 54% slower on PolyBench, so the semantic model is not the main cause.
  • Hand-editing CompCert's assembly showed missing loop-invariant code motion, loop rotation, dead-store elimination through pointers, redundant zero-extensions and false SSE register dependencies as significant costs.
  • Agents implemented five new passes plus refinements, using translation validation for complex passes; each pass was proven with zero Admitted proofs and the trusted base required human approval.
  • A trusted-base lemma approved by the author was false: the memory model wrap-around allowed a merged 8-byte load to fail, so the fix added a global access_bounded invariant to the memory model.
  • Final results: on CompCert benchmarks the compiler is 4.0% to 6.1% behind gcc -O2, on PolyBench 13.5% to 14.2% behind (but ahead of gcc -O1), and on held-out big programs 8.5% to 9.1% behind.
  • Remaining gaps are attributed to heap alias analysis, interprocedural register allocation, and stack frame back-link costs, which were identified but not implemented.

Discussion The thread is very small, with only two comments. One points to the author's X thread with the article's announcement. The other is a skeptical comment from rurban, who says they care more about CompCert's correctness bugs and omissions than its speed, reporting that their own C test suite shows 1674 passes and 2525 failures. Overall the mood is cautious and low-engagement, with the main substance being the article itself rather than a developed debate.

  • Correctness matters more than performance for CompCert (a few): The one substantive comment argues that further speed work is less valuable than fixing the many bugs and omissions the commenter found in their own C test suites, reporting 2525 failures against 1674 passes.
  • Share the article via the author's thread (a few): One commenter simply points to the author's X post about the work, offering a secondary discussion channel rather than an opinion on the results.

Links from the comments

#CompCert #compilers #formalVerification #LLMAgents #gcc #performance