Post #4460817
2026-08-09 03:41 UTC
oh hey cargo-show-asm is really quite nice. Really handy to have around as I figure out how to write code that both looks nice and that rustc/LLVM can SIMD optimize the snot out of.
Also TIL that #[inline] both hints at LLVM to inline a bit more aggressively than the default, but also dumps the function's MIR into the crate metadata so that callers in other crates get a chance to inline it as well.
In theory LTO should also take care of cross-crate inlining, but it seems fiddlier to make happen consistently, and may be too late for the inlining to enable other local optimizations.
And also the rustc+LLVM optimization passes continue to be impressively good at figuring out what I'm doing and making it go brrr.
Replies (1)
-
@danderson@hachyderm.io 2026-08-09 04:08
Ah yes here we go, I added a tiny bit more code and somehow that turned all the assembler output into complete madness where it's doing operations that seem entirely unrelated to what the source code says. I expect that once I unravel it, it'll have figured out some 27-dimensional reframing of what the code was doing that lets it do what I asked in a single completely cursed AVX-512 instruction or something. Like, even the loop iteration counts have turned into a number that appears nowhere in the source code.