2 ms·
Rust's borrow checker could probably be used for alias analysis, and avoid emitting redundant load instructions. That would give it a competitive advantage to C
by stabbles 3y ago
Rust's borrow checker could probably be used for alias analysis, and avoid emitting redundant load instructions. That would give it a competitive advantage to C++. Does something like this exist yet?
- cwzwarich 3y agoRust actually already does this to some degree, using LLVM’s noalias annotations (after many years of exposing latent LLVM bugs and having to disable them). There’s more that can be done here, see e.g. https://github.com/rust-lang/rust/issues/16515 https://github.com/rust-lang/rust/issues/16515 There are also soundness issues around async/await: https://github.com/rust-lang/rust/issues/63818 https://github.com/rust-lang/rust/issues/63818 LLVM’s aliasing model isn’t really optimal for a language like Rust with very precise memory dependence information, but using anything else would mean making a whole new optimizer/backend from scratch.