diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -4049,19 +4049,17 @@ // Don't do anything with the operands, just extend the result. continue; } else if (auto *IE = dyn_cast(I)) { - auto Elements = cast(IE->getOperand(0)->getType()) - ->getNumElements(); + auto Elements = + cast(IE->getOperand(0)->getType())->getElementCount(); auto *O0 = B.CreateZExtOrTrunc( - IE->getOperand(0), - FixedVectorType::get(ScalarTruncatedTy, Elements)); + IE->getOperand(0), VectorType::get(ScalarTruncatedTy, Elements)); auto *O1 = B.CreateZExtOrTrunc(IE->getOperand(1), ScalarTruncatedTy); NewI = B.CreateInsertElement(O0, O1, IE->getOperand(2)); } else if (auto *EE = dyn_cast(I)) { - auto Elements = cast(EE->getOperand(0)->getType()) - ->getNumElements(); + auto Elements = + cast(EE->getOperand(0)->getType())->getElementCount(); auto *O0 = B.CreateZExtOrTrunc( - EE->getOperand(0), - FixedVectorType::get(ScalarTruncatedTy, Elements)); + EE->getOperand(0), VectorType::get(ScalarTruncatedTy, Elements)); NewI = B.CreateExtractElement(O0, EE->getOperand(2)); } else { // If we don't know what to do, be conservative and don't do anything.