I'm pretty sure there is a cargo/compiler flat that will tell rustc to output which loops weren't vectorized and why. I just can't find it or remember what it is. Does anyone here know?
This seems like it would be handled by LLVM and not rustc proper, and indeed LLVM has
-Rpass-analysis=loop-vectorize) which sounds like what you want. You can pass this to rustc with
rustc -C llvm-args='-Rpass-missed=loop-vectorize' src/lib.rs --crate-type lib
rustc rejects that as an unknown command line argument. I tried it with various combinations of the quotes too.
Oh, I guess rustc's interface to LLVM doesn't support passing the option in that form, oops. Looking at the output of
rustc -C llvm-args=--help-list-hidden, you probably want
-C llvm-args='--pass-remarks-missed=loop-vectorize', or the same with
missed replaced by
Thanks! I finally got it to work with:
cargo rustc --release -- -g -O -C llvm-args='--pass-remarks-missed=loop-vectorize'
For those reading this later,
cargo rustc --release -- -g -O -C llvm-args='--pass-remarks-analysis=loop-vectorize' is very nice because it tells you why the loop wasn't vectorized.
rustc -C llvm-args=--help-list-hidden is FULL of other options. That's the way to help yourself!