This patch uses SCEV to avoid inserting some bounds checks when they are not needed. This slightly improves the performance of code compiled with the bounds check sanitizer.
This approach was suggested in https://reviews.llvm.org/D49492.