I recently read somewhere that even though no-aliasing is off by default, there is still an option to make the compiler use the no-aliasing feature. I didnt find the exact method to switch it on though. Can anyone let me know if that option is still available or has it been removed?
I think you're looking for this tracking issue: Re-enable noalias annotations by default once LLVM no longer miscompiles them · Issue #54878 · rust-lang/rust · GitHub .
The compiler flag to enable no-alias optimization is
-Z mutable-noalias=yes which suggested in the 3rd comments in that issue.
I tried the same but I get error saying the flag is not known. I tried with cargo though, so is any extra work required? I typed
cargo +nightly build -Z mutable-noalias=yes.
I think it is a
rustc argument, not a
cargo argument. Try this:
RUSTFLAGS="-Z mutable-noalias=yes" cargo +nightly build
It worked now, thank you very much for the quick reply.
For the future readers, the feature is off by default because currently the LLVM has some bugs on handling noalias attribute. Once those bugs are fixed, the rustc will turn the feature on by default.