The delinearization algorithm did not consider terms which had an extension without a multiply factor, i.e. a identify factor. We lose cases where size is char type where there will no multiply factor.
this patch is clearly correct (in terms of it does not mis-compiling anything) and also beneficial. To be a little bit more sure we do not accidentally regress on test cases that have an sext further outside, I would probably match for the expression sext(SCEVUnknown), specifically. This seems to be the precise pattern we are looking for.
I also tested your patch on 3D arrays/loops and due to SCEV hoisting these checks out the simple matching your propose does not work. It might be interesting to look into handling sext expressions for 3D arrays as well.
I am fine with this patch, but as written in my previous review I would prefer for it to match for the precise pattern sext<SCEVUnknown>, rather than just sext<*> to make it very clear for which pattern we match. If this change is OK for you and still catches the cases you are interested in, just post an updated patch and I will commit it.