early-exitThe loop can leave before its trip count
Reported by --explain after a verdict.
mettle explain early-exit
A break or an early return means the number of iterations is not known when the loop starts. A kernel that processes eight elements per step could run past the element the loop meant to stop at.
Fix: where the search and the work are separable, do the work in a counted loop and the search in its own. A break on the last iteration costs nothing to keep scalar.
Related
- call-in-bodyThe loop body calls a function
- extern-call-in-bodyThe loop body calls an external function
- indirect-callThe loop body calls through a function pointer
- alloc-in-bodyThe loop body allocates
- inline-asmThe loop body contains inline assembly
- control-flowThe loop body branches
- int16-elements16-bit integer elements have no kernel
- int64-elements64-bit integer elements have no kernel