4 ms·
Alias analysis has been the holy grail of compiler development for a while. In C++ it's a global, imperfect, and expensive analysis. In Rust you get it for free
by Manishearth 10y ago
Alias analysis has been the holy grail of compiler development for a while. In C++ it's a global, imperfect, and expensive analysis. In Rust you get it for free.
C++ can't do the same thing Rust does because it would be a breaking change to have finer-grained distinctions between the types of references.
This is a matter of language semantics, not compiler implementation. rustc isn't doing anything new here, LLVM already knows how to make this optimization and is making it.
- tmccrmck 10y agoWhat specifically makes you think alias analysis is the holy grail of compiler optimization?
- Manishearth 10y agoI spent some time studying the subject a few years ago. Most of the current efforts I saw were about improving alias analysis. Could have been a skewed view of the thing, but the researchers I talked to seemed to feel like it was. Some compiler devs I've talked to do too. In general it does unlock a lot of opportunities when it comes to optimization.