I’m curious about the llvm miscompile with noalias. What is it about rustc adding noalias annotations that surfaces these llvm bugs? Doesn’t clang or a midend optimization pass add them too?
Conversation
Replying to
Probably an inconsistency between what non aliasing means in Rust and what it means in [LLVM's wrong reading of] C...
2
1
And no, I don't see how an optimization pass can add noalias annotations.
2
LLVM has to translate them to the new scope when it does inlining, including converting noalias markers on function parameters to scoped metadata. This was yet another bug in how that kind of thing gets handled. It's complex and has to handle all the details / interactions right.
Rust has uncovered a bunch of these LLVM bugs. It has consistently been caused by issues in LLVM rather than in rustc. It also definitely impacts C but restrict isn't widely used. Most references in Rust should be marked noalias. It means no memory dependencies between them.
1
6
LLVM NoAlias means that two pointers do not have memory dependencies between them, i.e. there aren't writes made through one of the pointers that are visible through the other. Rust guarantees that while an &mut reference is active/usable, nothing else reads/writes that data.
1
2
Show replies


