-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Description
This is my first Rust enhancement request.
With the Go language compiler version 1.7, you can build the code using -gcflags="-d=ssa/check_bce/debug=1" to show which code lines still need checking bounds:
http://www.tapirgames.com/blog/golang-1.7-bce
Finding where the compiler is not able to optimize away run-time bound checks is important for some kinds of code where performance matters:
Currently to do that in Rust I have to generate the asm with --emit asm, search the function(s) (this sometimes is not so easy because of inlining) and then read the asm to understand if and where it performs bound checks. This is a bit laborious and not handy. So is it possible to add to Rustc a compilation switch similar to Go that outputs all the lines and column where LLVM isn't able to remove array bound tests?
In-bound test(s):
16 | foo[i] -= 1;
^
32 | foo[i] += bar[j];
^ ^
(Having this compiler switch is only about one third of this performance battle).