Page MenuHomePhabricator

[SVE] Mark VectorType::getNumElements() deprecated
ClosedPublic

Authored by ctetreau on Apr 14 2020, 10:05 AM.

Details

Summary

getNumElements() is being removed from base VectorType in
order to eliminate the class of bugs in which a scalable vector
is accidentally treated like a fixed length vector. Clients of
this function should either call getElementCount(), and handle
the case where getElementCount().isScalable() is true, or they can
cast to FixedVectorType and call getNumElements() if they are
sure that the vector has fixed width.

Deprecated VectorType functions will be removed after the LLVM
12 branch.

See: http://lists.llvm.org/pipermail/llvm-dev/2020-March/139811.html

Diff Detail

Event Timeline

ctetreau created this revision.Apr 14 2020, 10:05 AM
ctetreau planned changes to this revision.May 29 2020, 11:53 AM

Per recent discussions on the mailing lists, I'll be deprecating VectorType::getNumElements() rather than deleting it now.

ctetreau updated this revision to Diff 271495.Jun 17 2020, 2:49 PM

deprecate rather than remove VectorType::getNumElements()

ctetreau retitled this revision from [SVE] Move VectorType::getNumElements() into FixedVectorType to [SVE] Mark VectorType::getNumElements() deprecated.Jun 17 2020, 2:50 PM
ctetreau edited the summary of this revision. (Show Details)
fpetrogalli accepted this revision.Aug 28 2020, 12:25 PM

LGTM!

Nit: there is a typo in the commit message: whre -> where.

This revision is now accepted and ready to land.Aug 28 2020, 12:25 PM
ctetreau removed parent revisions: D85156: [SVE] Remove bad calls to VectorType::getNumElements() from X86, D81504: [SVE] Remove calls to VectorType::getNumElements from Analysis, D83339: [SVE] Remove calls to VectorType::getNumElements from AsmParserTest, D82583: [SVE] Remove calls to VectorType::getNumElements from mlir, D82582: [SVE] Remove calls to VectorType::getNumElements from clang, D82508: [SVE] Remove calls to VectorType::getNumElements from X86, D82243: [SVE] Remove calls to VectorType::getNumElements from Scalar, D82237: [SVE] Remove calls to VectorType::getNumElements from InstCombine, D82219: [SVE] Remove calls to VectorType::getNumElements from IPO, D82218: [SVE] Remove calls to VectorType::getNumElements from AggressiveInstCombine, D82217: [SVE] Remove calls to VectorType::getNumElements from WebASM, D82216: [SVE] Remove calls to VectorType::getNumElements from ARM, D82214: [SVE] Remove calls to VectorType::getNumElements from AArch64, D82212: [SVE] Remove calls to VectorType::getNumElements from FuzzMutate, D82211: [SVE] Remove calls to VectorType::getNumElements from ExecutionEngine, D82210: [SVE] Remove calls to VectorType::getNumElements from CodeGen, D82209: [SVE] Remove calls to VectorType::getNumElements from Bitcode, D82208: [SVE] Remove calls to VectorType::getNumElements from AsmParser, D82056: [SVE] Remove calls to VectorType::getNumElements from Transforms/Vectorize, D82057: [SVE] Remove calls to VectorType::getNumElements from Transforms/Utils, D81500: [SVE] Remove calls to VectorType::getNumElements from IR.Aug 31 2020, 1:56 PM
ctetreau edited the summary of this revision. (Show Details)Aug 31 2020, 2:11 PM
This revision was landed with ongoing or failed builds.Aug 31 2020, 3:13 PM
This revision was automatically updated to reflect the committed changes.