Broken loop unrolling in branchy loop #117659
Labels
A-codegen
Area: Code generation
A-iterators
Area: Iterators
C-bug
Category: This is a bug.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
I've been looking at why some iterator fail to optimize well (#38038 & #80416) and it seems like it all boils down to having branches in the
next()
call which breaks loop unrolling. To give some context, it seems like these are some of the most low-hanging fruit in theIterator
API which almost always ends up generating ideal assembly.This fails to unroll:
... while this doesn't:
The first case can be unrolled manually:
... but this doesn't work with
Iterator::next
.The text was updated successfully, but these errors were encountered: