The borrIR borrow checker brings Rust’s ownership rules to raw LLVM IR. Its developer built it on the premise that if AI agents write most of the code and nobody reads it, the agents might as well write something close to assembly, as long as a checker can prove it is memory safe. The project also ships a libc-free standard library called libir, a bitcode package manager and a browser playground.
The developer says the whole tool was generated by an LLM agent.
The argument behind it
The idea starts from agentic coding, where an agent writes, changes and reasons about code with little human oversight. Rust has become a popular target for agents, partly because its compile-time checks catch memory bugs. Anthropic has also rewritten its messaging system from Python to Rust for speed. Rust has well-known costs, though: complexity, slow compiles and large piles of build artifacts. A screenshot in the project write-up shows a developer complaining about deleting 100 GB of build files every couple of days.
The developer’s point is that a borrow checker doesn’t need Rust. If nobody reads the output, the language no longer has to be friendly to humans. Compilers already turn source into assembly that people trust and never inspect. Having the agent write LLVM IR directly moves that same trust up one layer.

What the checker does
borrIR is a static analysis pass that sits in front of llvm-as, the LLVM IR assembler. It parses textual IR, or disassembles .bc bitcode with llvm-dis, builds each function’s control-flow graph, tracks pointer provenance and runs a forward fixed-point dataflow analysis to enforce affine ownership.
The write-up shows a use-after-move bug twice, once in Rust and once in LLVM IR. In the IR version a pointer is passed to a function marked as taking ownership, then loaded afterwards. Running borrir check on the file produces a diagnostic similar to the one Rust gives. It reports error E0001, “use of moved pointer”, marks where ownership moved and where the value is used afterwards, and suggests borrowing with readonly instead.
The first release reports eight error classes, E0001 to E0008, plus one warning. They run from use after move to laundering a pointer through inttoptr.
One side effect is that Non-Lexical Lifetimes come almost for free. Early Rust held a borrow until the end of its scope, and fixing that required inventing MIR. LLVM IR has no scopes, so the problem never appears.

A standard library without libc
The project drops every library that higher-level languages might have produced. libir is a set of verified LLVM IR modules for memory allocation, I/O and string handling, and each module passes the borrow checker itself. It replaces libc and its relatives.
The resulting binaries are fully static ELF executables with no crt0, no libc and no dynamic linker. They are small, and the build leaves little behind in the way of intermediate files. There is one catch: LLVM must be told to disable passes such as LoopIdiomRecognize. Otherwise it rewrites hand-written loops into calls to standard library functions, and those calls fail to link without libc.
A package manager for pre-assembled .bc packages lets people share and reuse verified modules.
Why checks per function matter for agents
Ownership is checked one function at a time. That means an agent doesn’t have to keep the whole program in its context to know who frees what. The checker works as a safety net for the person and as a feedback loop for the agent.
What it means for developers
Few people will hand an entire codebase to an agent and never look at it. For those who do, borrIR shows one way to keep a safety check in the loop: the agent writes IR, the checker rejects ownership mistakes, and the agent fixes them from the diagnostic. Whether teams will accept code that no human reads is a separate question, and the project doesn’t try to answer it.
Try it yourself
A live WebAssembly playground lets visitors try to break the checker in the browser. Nix users can run the hash-demo example straight from the project repository, and the documentation lists every error class and the warning.
The project’s tagline sums up its attitude: programming languages are for humans, and nobody asked the agents whether they wanted one.
Source: Farid Zakaria’s Blog