CGP can move instructions like a ptrtoint into a loop, but the MVETailPredication when converting them will currently assume invariant trip counts. This tries to ensure the operands are loop invariant, and bails if not.
This test I actually want to turn into something better, I have managed to write up some test and put that into D101263.
Otherwise we have to do something about the vectorizer costs, because this is obviously not beneficial. I'm hoping that by optimizing it we can keep the vectorization.