Repository navigation
Reuse checked Rust slice constants before LLVM optimization - #22
Open
charliermarsh wants to merge 1 commit into
Open
charliermarsh wants to merge 1 commit into
charliermarsh wants to merge 1 commit into
Conversation
charliermarsh
force-pushed
the
charlie/llvm-cache-preoptimizer-slice-constants
branch
from
November 10, 2026 14:24
95a2277 to
fba5a62
Compare
charliermarsh
marked this pull request as ready for review
November 10, 2026 14:24
This was referenced Nov 10, 2026
charliermarsh
added a commit
to astral-experiments/ohm
that referenced
this pull request
Nov 10, 2026
## Summary Ohm 1.99.0-31 lets optimized Rust libraries reuse a checked LLVM object before optimization. LLVM can also reuse an object after bounded source edits when every observed line has an unambiguous destination. These paths target incremental O1 builds on x86-64 Linux. [LLVM stack](astral-experiments/ohm-llvm#22) · [Rust compiler change](astral-experiments/ohm-rust#397) Rustc preserves caller locations across worktrees, indexes consecutive procedural-macro spans directly, and retains the joined span of type-relative struct paths. Clippy uses those paths when checking patterns and expressions. [Rust span changes](astral-experiments/ohm-rust#400) · [Clippy companion](astral-experiments/ohm-rust-clippy#83) Cargo documents libraries with names up to 242 bytes and retains active shared builds whose compiler or driver path contains non-UTF-8 bytes. Its checked-in lockfile also matches dependency resolution in a read-only checkout. [Cargo stack](astral-experiments/ohm-cargo#530)
charliermarsh
force-pushed
the
charlie/llvm-cache-preoptimizer-slice-constants
branch
from
November 17, 2026 05:36
fba5a62 to
7b63e0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The complete −31 SDK used 66.22% fewer instructions on the warm uv edit and 8.90% fewer instructions on the warm Ruff edit. The control was the same release candidate before the LLVM cache stack. Each run counted Cargo, the compilers and the final linker.
Rustc sometimes leaves a detached two-field slice constant in the LLVM context. The optimizer can observe its address and operand use-list position even when ordinary bitcode omits it. We record those inputs for supported terminal slices. If an unrepresented user could affect a result, LLVM runs the optimizer normally.
An isolated comparison against rustc #397’s original LLVM revision admitted 120 additional codegen units before optimization and used 27.89% fewer instructions on the warm uv edit across eight pairs. Measured uv edit
The eight warm pairs and the independent replay used LLVM
381ca8e2fb66and95a2277ca998. On a separate rebuild with empty LLVM stores, they used 2,261,502,476,995 and 2,261,235,213,019 instructions, respectively (0.012% fewer, one pair). Each wrote 382 native objects with zero hits. The change wrote 129 additional early-index records, totaling 17,544 bytes. The current base578e066665b3and headfba5a6233165contain the same change by Git patch ID after the stack rebase.On the current public base
578e066665b3and headfba5a6233165, one fresh pair on that same warm edit used 1,167,953,990,674 → 864,354,455,979 instructions, 25.994% fewer for the completecargo +ohm build --locked --offline --profile fast-build -p uv --bin uv. Early hits rose from 226 to 344. Both sides compiled 40 units and produced identical bytes in all 4,075 machine objects, all 40 measured metadata files and the linked uv executable. Five CLI probes also matched. Ordinary native runs recorded multipleuv_configurationmetadata encodings with the same public hash and six decoded views. Each rebased empty-store control wrote 377 objects with zero hits.The warm results report the median reduction across two pairs. Each first-fill result compares one empty store with a bypassed store on the same compiler and pre-edit target. The Ruff build script recorded Git revision data in native builds and omitted it under the instruction counter. Every reported pair had matching inputs. Qualified SDK