Migrate off deprecated llvm::VectorType::getNumElements

Cast to FixedVectorType or use getElementCount where appropriate.

PiperOrigin-RevId: 354900671
Change-Id: I546953b169c5b4b7e5bf9d25d71a5d9051c2fa35
This commit is contained in:
Benjamin Kramer 2021-02-01 03:02:18 -08:00 committed by TensorFlower Gardener
parent 0f8a271836
commit b1952612df
2 changed files with 4 additions and 3 deletions

View File

@ -1547,7 +1547,7 @@ IrEmitter::EmitInnerLoopForVectorizedReduction(
auto shard_type = accumulator_shard->getType()->getPointerElementType();
if (auto vector_type = llvm::dyn_cast<llvm::VectorType>(shard_type)) {
initial_value =
VectorSplat(vector_type->getNumElements(), init_value_ssa);
VectorSplat(vector_type->getElementCount(), init_value_ssa);
} else {
initial_value = init_value_ssa;
}

View File

@ -121,8 +121,9 @@ void RewriteCalls(
}
// Generate the vectorized code.
CHECK_EQ(vector_width,
llvm::cast<llvm::VectorType>(input->getType())->getNumElements());
CHECK_EQ(
vector_width,
llvm::cast<llvm::FixedVectorType>(input->getType())->getNumElements());
llvm::Value* result = fn_body_generator(&b, input, vector_width);
// Downcast result to scalar type if necessary.