According to report by @JojoR, the assertion error was hit hence we need to have this check before the actual transformation. Reviewed By: Meinersbur, #loopoptwg Differential Revision: https://reviews.llvm.org/D136415