Bounds check optimizations are not applied if the accessed slice len is smaller than the upfront checked slice len #69101
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When using a loop and checking exact bounds upfront, vectorized instructions are used:
Godbolt
However when the upfront checks actually tests for a bigger slice size, the same optimizations are not applied:
Godbolt
Since slices of size 2048 are always also at least of size 1024, I would expect the generated code to be equivalent.
Meta
rustc --version --verbose
:Happens on nightly as well as 1.40 - as seen in Godbolt
The text was updated successfully, but these errors were encountered: