Hacker News new | past | comments | ask | show | jobs | submit login
Why does Rust not optimize code assuming that mutable references cannot alias? (stackoverflow.com)
13 points by nickm12 on July 31, 2019 | hide | past | favorite | 1 comment



These are not even the only fun bugs and issues that lurk in how various alias/invariant/etc related things are designed in llvm, and trying to figure out the regions they cover.

For anyone ever designing a compiler, do yourself a huge favor: do not try to scope aliasing/etc info using metadata. Make it an explicit part of the ir somehow so that the control and dataflow is explicit to the compiler. (GCC went thru the same fun before LLVM did).

It seems like a good idea at first, but it is almost impossible to keep it conservatively correct during transforms (unless you drop it when anything at all changes, which also turns out badly)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: