aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorHuihui Zhang <huihuiz@quicinc.com>2020-03-12 13:15:34 -0700
committerHuihui Zhang <huihuiz@quicinc.com>2020-03-12 13:22:41 -0700
commit118abf20173899e9e1667db1a9c850dc5570b6ae (patch)
treedba40cf35b91a20a47755929161a1021642889e4 /llvm/lib/IR/ConstantFold.cpp
parente91feeed21ee16abdb73f6e8cd471a253136e2cf (diff)
downloadllvm-118abf20173899e9e1667db1a9c850dc5570b6ae.zip
llvm-118abf20173899e9e1667db1a9c850dc5570b6ae.tar.gz
llvm-118abf20173899e9e1667db1a9c850dc5570b6ae.tar.bz2
[SVE] Update API ConstantVector::getSplat() to use ElementCount.
Summary: Support ConstantInt::get() and Constant::getAllOnesValue() for scalable vector type, this requires ConstantVector::getSplat() to take in 'ElementCount', instead of 'unsigned' number of element count. This change is needed for D73753. Reviewers: sdesmalen, efriedma, apazos, spatel, huntergr, willlovett Reviewed By: efriedma Subscribers: tschuett, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D74386
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index acd10b4..0da027f 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -2229,8 +2229,7 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C,
Constant *Idx0 = cast<Constant>(Idxs[0]);
if (Idxs.size() == 1 && (Idx0->isNullValue() || isa<UndefValue>(Idx0)))
return GEPTy->isVectorTy() && !C->getType()->isVectorTy()
- ? ConstantVector::getSplat(
- cast<VectorType>(GEPTy)->getNumElements(), C)
+ ? ConstantVector::getSplat(GEPTy->getVectorElementCount(), C)
: C;
if (C->isNullValue()) {