From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp') diff --git a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp index 42691b8a6154d..f7131926ee658 100644 --- a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp +++ b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp @@ -673,9 +673,9 @@ public: ElementInfo *EI; /// Vector Type - VectorType *const VTy; + FixedVectorType *const VTy; - VectorInfo(VectorType *VTy) + VectorInfo(FixedVectorType *VTy) : BB(nullptr), PV(nullptr), LIs(), Is(), SVI(nullptr), VTy(VTy) { EI = new ElementInfo[VTy->getNumElements()]; } @@ -735,7 +735,7 @@ public: if (!Op) return false; - VectorType *VTy = dyn_cast(Op->getType()); + FixedVectorType *VTy = dyn_cast(Op->getType()); if (!VTy) return false; @@ -785,8 +785,8 @@ public: /// \returns false if no sensible information can be gathered. static bool computeFromSVI(ShuffleVectorInst *SVI, VectorInfo &Result, const DataLayout &DL) { - VectorType *ArgTy = dyn_cast(SVI->getOperand(0)->getType()); - assert(ArgTy && "ShuffleVector Operand is not a VectorType"); + FixedVectorType *ArgTy = + cast(SVI->getOperand(0)->getType()); // Compute the left hand vector information. VectorInfo LHS(ArgTy); @@ -1200,14 +1200,15 @@ bool InterleavedLoadCombineImpl::combine(std::list &InterleavedLoad, IRBuilder<> Builder(InsertionPoint); Type *ETy = InterleavedLoad.front().SVI->getType()->getElementType(); unsigned ElementsPerSVI = - InterleavedLoad.front().SVI->getType()->getNumElements(); - VectorType *ILTy = VectorType::get(ETy, Factor * ElementsPerSVI); + cast(InterleavedLoad.front().SVI->getType()) + ->getNumElements(); + FixedVectorType *ILTy = FixedVectorType::get(ETy, Factor * ElementsPerSVI); SmallVector Indices; for (unsigned i = 0; i < Factor; i++) Indices.push_back(i); InterleavedCost = TTI.getInterleavedMemoryOpCost( - Instruction::Load, ILTy, Factor, Indices, InsertionPoint->getAlignment(), + Instruction::Load, ILTy, Factor, Indices, InsertionPoint->getAlign(), InsertionPoint->getPointerAddressSpace()); if (InterleavedCost >= InstructionCost) { @@ -1220,7 +1221,7 @@ bool InterleavedLoadCombineImpl::combine(std::list &InterleavedLoad, "interleaved.wide.ptrcast"); // Create the wide load and update the MemorySSA. - auto LI = Builder.CreateAlignedLoad(ILTy, CI, InsertionPoint->getAlignment(), + auto LI = Builder.CreateAlignedLoad(ILTy, CI, InsertionPoint->getAlign(), "interleaved.wide.load"); auto MSSAU = MemorySSAUpdater(&MSSA); MemoryUse *MSSALoad = cast(MSSAU.createMemoryAccessBefore( @@ -1230,7 +1231,7 @@ bool InterleavedLoadCombineImpl::combine(std::list &InterleavedLoad, // Create the final SVIs and replace all uses. int i = 0; for (auto &VI : InterleavedLoad) { - SmallVector Mask; + SmallVector Mask; for (unsigned j = 0; j < ElementsPerSVI; j++) Mask.push_back(i + j * Factor); @@ -1265,8 +1266,11 @@ bool InterleavedLoadCombineImpl::run() { for (BasicBlock &BB : F) { for (Instruction &I : BB) { if (auto SVI = dyn_cast(&I)) { + // We don't support scalable vectors in this pass. + if (isa(SVI->getType())) + continue; - Candidates.emplace_back(SVI->getType()); + Candidates.emplace_back(cast(SVI->getType())); if (!VectorInfo::computeFromSVI(SVI, Candidates.back(), DL)) { Candidates.pop_back(); -- cgit v1.2.3