https://github.com/Mel-Chen commented: It looks correct to me. BTW, I don't have a particular preference, but I do have one question: as an optimization, should this be implemented in VPlanTransform::optimize? https://github.com/llvm/llvm-project/pull/150368