Consider vectorizing the following case:
struct layer_data { unsigned char arr[2048]; } *ld; void Next_Packet() { int l = 0; while (l<2048) { ld->arr[l++] = 3; ld->arr[l++] = 4; } }
The GEPs for the assignments have three operands: the ptr ld, a
zero-index into ld, and another indexing depending on the loop induction
variable. However, findForkedSCEVs() suffers from the limitation that it
can only handle GEPs with two operands. Lift this limitation, and
successfully vectorize the above example, albeit with runtime
memory-checks.
This seems to assume that the same scale can be applied to all GEP indices, which is not correct. I think the only reason this happens to work for your example is that one of the indices is zero.
If you want to handle this generically, what you should probably do is either a) use collectOffsets() to convert the GEP into scale multiply representation or b) get the SCEV for the GEP and analyze SCEVUnknowns for forking.