aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorChristopher Tetreault <ctetreau@quicinc.com>2020-04-23 10:58:37 -0700
committerChristopher Tetreault <ctetreau@quicinc.com>2020-04-23 11:51:22 -0700
commit3ecced163f539dd04e86ba9dbf27e49bd89a4a11 (patch)
treeeebbcd03db76998befeaed39a6927874ecd4fcf6 /llvm/lib/IR/ConstantFold.cpp
parent757c7c244b70cb35269dfe95aa801fd0ea3c5a0c (diff)
downloadllvm-3ecced163f539dd04e86ba9dbf27e49bd89a4a11.zip
llvm-3ecced163f539dd04e86ba9dbf27e49bd89a4a11.tar.gz
llvm-3ecced163f539dd04e86ba9dbf27e49bd89a4a11.tar.bz2
[SVE] Remove calls to isScalable from IR
Reviewers: efriedma, sdesmalen, dexonsmith, dblaikie Reviewed By: sdesmalen Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77691
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index d286379..8539b91f 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -49,7 +49,7 @@ static Constant *BitCastConstantVector(Constant *CV, VectorType *DstTy) {
// Do not iterate on scalable vector. The num of elements is unknown at
// compile-time.
- if (DstTy->isScalable())
+ if (isa<ScalableVectorType>(DstTy))
return nullptr;
// If this cast changes element count then we can't handle it here:
@@ -848,7 +848,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val,
// Do not iterate on scalable vector. The num of elements is unknown at
// compile-time.
VectorType *ValTy = cast<VectorType>(Val->getType());
- if (ValTy->isScalable())
+ if (isa<ScalableVectorType>(ValTy))
return nullptr;
unsigned NumElts = cast<VectorType>(Val->getType())->getNumElements();
@@ -876,7 +876,7 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
ArrayRef<int> Mask) {
auto *V1VTy = cast<VectorType>(V1->getType());
unsigned MaskNumElts = Mask.size();
- ElementCount MaskEltCount = {MaskNumElts, V1VTy->isScalable()};
+ ElementCount MaskEltCount = {MaskNumElts, isa<ScalableVectorType>(V1VTy)};
Type *EltTy = V1VTy->getElementType();
// Undefined shuffle mask -> undefined value.
@@ -895,7 +895,7 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
}
// Do not iterate on scalable vector. The num of elements is unknown at
// compile-time.
- if (V1VTy->isScalable())
+ if (isa<ScalableVectorType>(V1VTy))
return nullptr;
unsigned SrcNumElts = V1VTy->getNumElements();
@@ -972,8 +972,7 @@ Constant *llvm::ConstantFoldUnaryInstruction(unsigned Opcode, Constant *C) {
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length
// vectors are always evaluated per element.
- bool IsScalableVector = isa<VectorType>(C->getType()) &&
- cast<VectorType>(C->getType())->isScalable();
+ bool IsScalableVector = isa<ScalableVectorType>(C->getType());
bool HasScalarUndefOrScalableVectorUndef =
(!C->getType()->isVectorTy() || IsScalableVector) && isa<UndefValue>(C);
@@ -1046,8 +1045,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *C1,
// Handle scalar UndefValue and scalable vector UndefValue. Fixed-length
// vectors are always evaluated per element.
- bool IsScalableVector = isa<VectorType>(C1->getType()) &&
- cast<VectorType>(C1->getType())->isScalable();
+ bool IsScalableVector = isa<ScalableVectorType>(C1->getType());
bool HasScalarUndefOrScalableVectorUndef =
(!C1->getType()->isVectorTy() || IsScalableVector) &&
(isa<UndefValue>(C1) || isa<UndefValue>(C2));
@@ -2000,7 +1998,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
// Do not iterate on scalable vector. The number of elements is unknown at
// compile-time.
- if (C1VTy->isScalable())
+ if (isa<ScalableVectorType>(C1VTy))
return nullptr;
// Fast path for splatted constants.