Consider the following loop:
int red = ii; for (int i = 0; i < n; ++i) red = (a[i] > b[i]) ? i : red;
We can vectorize this loop if i is an increasing induction variable.
The final reduced value will be tha maximum of i that the condition
a[i] > b[i] is satisfied, or the start value ii.
This patch added new RecurKind enums - IFindLastIV and FFindLastIV.
TODOs:
- Casting increasing induction variable, like truncate, SExt.
To keep the diff more compact, could you split the FP handling off? It also looks like codegen is at least not tested for the FP case?