diff options
author | Christopher Tetreault <ctetreau@quicinc.com> | 2020-07-22 14:36:48 -0700 |
---|---|---|
committer | Christopher Tetreault <ctetreau@quicinc.com> | 2020-07-22 15:19:05 -0700 |
commit | 23c5e59d9feeb8e53c9c05a06801897233ec4453 (patch) | |
tree | cb1d64d2980cdc7faa8ea550a9fbb47138b5b314 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 97a0f80c469c338e9173355e9f8a0a977adfe266 (diff) | |
download | llvm-23c5e59d9feeb8e53c9c05a06801897233ec4453.zip llvm-23c5e59d9feeb8e53c9c05a06801897233ec4453.tar.gz llvm-23c5e59d9feeb8e53c9c05a06801897233ec4453.tar.bz2 |
[SVE] Remove calls to VectorType::getNumElements from Analysis
Reviewers: efriedma, fpetrogalli, c-rhodes, asbirlea, RKSimon
Reviewed By: RKSimon
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81504
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 12abe34..0ab2a13 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -172,8 +172,8 @@ static bool getShuffleDemandedElts(const ShuffleVectorInst *Shuf, return false; int NumElts = - cast<VectorType>(Shuf->getOperand(0)->getType())->getNumElements(); - int NumMaskElts = Shuf->getType()->getNumElements(); + cast<FixedVectorType>(Shuf->getOperand(0)->getType())->getNumElements(); + int NumMaskElts = cast<FixedVectorType>(Shuf->getType())->getNumElements(); DemandedLHS = DemandedRHS = APInt::getNullValue(NumElts); if (DemandedElts.isNullValue()) return true; @@ -3489,9 +3489,10 @@ bool llvm::isKnownNeverInfinity(const Value *V, const TargetLibraryInfo *TLI, } // try to handle fixed width vector constants - if (isa<FixedVectorType>(V->getType()) && isa<Constant>(V)) { + auto *VFVTy = dyn_cast<FixedVectorType>(V->getType()); + if (VFVTy && isa<Constant>(V)) { // For vectors, verify that each element is not infinity. - unsigned NumElts = cast<VectorType>(V->getType())->getNumElements(); + unsigned NumElts = VFVTy->getNumElements(); for (unsigned i = 0; i != NumElts; ++i) { Constant *Elt = cast<Constant>(V)->getAggregateElement(i); if (!Elt) @@ -3593,9 +3594,10 @@ bool llvm::isKnownNeverNaN(const Value *V, const TargetLibraryInfo *TLI, } // Try to handle fixed width vector constants - if (isa<FixedVectorType>(V->getType()) && isa<Constant>(V)) { + auto *VFVTy = dyn_cast<FixedVectorType>(V->getType()); + if (VFVTy && isa<Constant>(V)) { // For vectors, verify that each element is not NaN. - unsigned NumElts = cast<VectorType>(V->getType())->getNumElements(); + unsigned NumElts = VFVTy->getNumElements(); for (unsigned i = 0; i != NumElts; ++i) { Constant *Elt = cast<Constant>(V)->getAggregateElement(i); if (!Elt) |