diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:43:05 +0000 |
commit | 349cc55c9796c4596a5b9904cd3281af295f878f (patch) | |
tree | 410c5a785075730a35f1272ca6a7adf72222ad03 /contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp | |
parent | cb2ae6163174b90e999326ecec3699ee093a5d43 (diff) | |
parent | c0981da47d5696fe36474fcf86b4ce03ae3ff818 (diff) |
Merge llvm-project main llvmorg-14-init-10186-gff7f2cfa959b
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-10186-gff7f2cfa959b.
PR: 261742
MFC after: 2 weeks
Diffstat (limited to 'contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp b/contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp index 0f4945bad5ab..98f6ccf81973 100644 --- a/contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp +++ b/contrib/llvm-project/llvm/lib/IR/IRBuilder.cpp @@ -94,11 +94,22 @@ Value *IRBuilderBase::CreateVScale(Constant *Scaling, const Twine &Name) { } Value *IRBuilderBase::CreateStepVector(Type *DstType, const Twine &Name) { - if (isa<ScalableVectorType>(DstType)) - return CreateIntrinsic(Intrinsic::experimental_stepvector, {DstType}, {}, - nullptr, Name); - Type *STy = DstType->getScalarType(); + if (isa<ScalableVectorType>(DstType)) { + Type *StepVecType = DstType; + // TODO: We expect this special case (element type < 8 bits) to be + // temporary - once the intrinsic properly supports < 8 bits this code + // can be removed. + if (STy->getScalarSizeInBits() < 8) + StepVecType = + VectorType::get(getInt8Ty(), cast<ScalableVectorType>(DstType)); + Value *Res = CreateIntrinsic(Intrinsic::experimental_stepvector, + {StepVecType}, {}, nullptr, Name); + if (StepVecType != DstType) + Res = CreateTrunc(Res, DstType); + return Res; + } + unsigned NumEls = cast<FixedVectorType>(DstType)->getNumElements(); // Create a vector of consecutive numbers from zero to VF. |