Counter in slice iter fails to eliminate bounds check #132557
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
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.
The following code (somewhat extracted from #126425) includes an unreachable bounds check panic
https://godbolt.org/z/vzooGexnj
This bounds check can be eliminated: Alive2
This also occurs with reverse iteration (like in the original) and iterating
0..buf.len()
instead of direct slice iteration. Lowering the slice length to the point where the loop is fully unrolled does eliminate this, but the exact number depends on the specific code.The text was updated successfully, but these errors were encountered: