Codegen forgets array size when used with iterators #63552
Labels
A-iterators
Area: Iterators
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.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-llvm
Working group: LLVM backend code generation
Consider these three functions:
I'd expect all of them to generate roughly the same code since our array
x
has a fixed compile-time size. With rustc 1.27.1 it does, but after that it seems there was a regression that causes the compiler to forget the size of the array and generate generic code rather than code specific for the array size when an iterator is used.Particularly damning is that the compiler generates an unrolled loop which is dead code as our array isn't large enough to ever qualify for unrolling.
The text was updated successfully, but these errors were encountered: