Array bound tests with for loop that get removed with while loops #81253
Labels
A-mir-opt
Area: MIR optimizations
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
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.
I think there's something wrong with Rust loops, they could lose some range information. So even if a for loop should be slightly simpler to analize compared to a while loop, the foo2 has no array bound tests, unlike foo1 (if N becomes 10 both get compiled to about the same asm without array bound tests):
rustc (V.1.51.0-nightly a4cbb44 2021-01-20) gives:
The text was updated successfully, but these errors were encountered: