Lines Matching refs:VF
273 static Type *ToVectorTy(Type *Scalar, unsigned VF) { in ToVectorTy() argument
274 if (Scalar->isVoidTy() || VF == 1) in ToVectorTy()
276 return VectorType::get(Scalar, VF); in ToVectorTy()
291 static bool hasIrregularType(Type *Ty, const DataLayout &DL, unsigned VF) { in hasIrregularType() argument
294 if (VF > 1) { in hasIrregularType()
295 auto *VectorTy = VectorType::get(Ty, VF); in hasIrregularType()
296 return VF * DL.getTypeAllocSize(Ty) != DL.getTypeStoreSize(VectorTy); in hasIrregularType()
355 AC(AC), ORE(ORE), VF(VecWidth), UF(UnrollFactor), in InnerLoopVectorizer()
381 void widenPHIInstruction(Instruction *PN, unsigned UF, unsigned VF);
646 unsigned VF; member in llvm::InnerLoopVectorizer
763 auto NewDIL = DIL->cloneWithDuplicationFactor(UF * VF); in setDebugLocFromInst()
863 unsigned selectInterleaveCount(bool OptForSize, unsigned VF,
873 void setCostBasedWideningDecision(unsigned VF);
901 bool isProfitableToScalarize(Instruction *I, unsigned VF) const { in isProfitableToScalarize()
902 assert(VF > 1 && "Profitable to scalarize relevant only for VF > 1."); in isProfitableToScalarize()
909 auto Scalars = InstsToScalarize.find(VF); in isProfitableToScalarize()
916 bool isUniformAfterVectorization(Instruction *I, unsigned VF) const { in isUniformAfterVectorization()
917 if (VF == 1) in isUniformAfterVectorization()
925 auto UniformsPerVF = Uniforms.find(VF); in isUniformAfterVectorization()
932 bool isScalarAfterVectorization(Instruction *I, unsigned VF) const { in isScalarAfterVectorization()
933 if (VF == 1) in isScalarAfterVectorization()
941 auto ScalarsPerVF = Scalars.find(VF); in isScalarAfterVectorization()
949 bool canTruncateToMinimalBitwidth(Instruction *I, unsigned VF) const { in canTruncateToMinimalBitwidth()
950 return VF > 1 && MinBWs.find(I) != MinBWs.end() && in canTruncateToMinimalBitwidth()
951 !isProfitableToScalarize(I, VF) && in canTruncateToMinimalBitwidth()
952 !isScalarAfterVectorization(I, VF); in canTruncateToMinimalBitwidth()
967 void setWideningDecision(Instruction *I, unsigned VF, InstWidening W, in setWideningDecision() argument
969 assert(VF >= 2 && "Expected VF >=2"); in setWideningDecision()
970 WideningDecisions[std::make_pair(I, VF)] = std::make_pair(W, Cost); in setWideningDecision()
975 void setWideningDecision(const InterleaveGroup<Instruction> *Grp, unsigned VF, in setWideningDecision() argument
977 assert(VF >= 2 && "Expected VF >=2"); in setWideningDecision()
983 WideningDecisions[std::make_pair(I, VF)] = std::make_pair(W, Cost); in setWideningDecision()
985 WideningDecisions[std::make_pair(I, VF)] = std::make_pair(W, 0); in setWideningDecision()
993 InstWidening getWideningDecision(Instruction *I, unsigned VF) { in getWideningDecision() argument
994 assert(VF >= 2 && "Expected VF >=2"); in getWideningDecision()
1001 std::pair<Instruction *, unsigned> InstOnVF = std::make_pair(I, VF); in getWideningDecision()
1010 unsigned getWideningCost(Instruction *I, unsigned VF) { in getWideningCost() argument
1011 assert(VF >= 2 && "Expected VF >=2"); in getWideningCost()
1012 std::pair<Instruction *, unsigned> InstOnVF = std::make_pair(I, VF); in getWideningCost()
1021 bool isOptimizableIVTruncate(Instruction *I, unsigned VF) { in isOptimizableIVTruncate() argument
1028 Type *SrcTy = ToVectorTy(cast<CastInst>(I)->getSrcTy(), VF); in isOptimizableIVTruncate()
1029 Type *DestTy = ToVectorTy(cast<CastInst>(I)->getDestTy(), VF); in isOptimizableIVTruncate()
1046 void collectInstsToScalarize(unsigned VF);
1051 void collectUniformsAndScalars(unsigned VF) { in collectUniformsAndScalars() argument
1053 if (VF == 1 || Uniforms.find(VF) != Uniforms.end()) in collectUniformsAndScalars()
1055 setCostBasedWideningDecision(VF); in collectUniformsAndScalars()
1056 collectLoopUniforms(VF); in collectUniformsAndScalars()
1057 collectLoopScalars(VF); in collectUniformsAndScalars()
1100 bool isScalarWithPredication(Instruction *I, unsigned VF = 1);
1117 bool memoryInstructionCanBeWidened(Instruction *I, unsigned VF = 1);
1122 bool interleavedAccessCanBeWidened(Instruction *I, unsigned VF = 1);
1172 VectorizationCostTy expectedCost(unsigned VF);
1176 VectorizationCostTy getInstructionCost(Instruction *I, unsigned VF);
1180 unsigned getInstructionCost(Instruction *I, unsigned VF, Type *&VectorTy);
1183 unsigned getMemoryInstructionCost(Instruction *I, unsigned VF);
1186 unsigned getMemInstScalarizationCost(Instruction *I, unsigned VF);
1189 unsigned getInterleaveGroupCost(Instruction *I, unsigned VF);
1192 unsigned getGatherScatterCost(Instruction *I, unsigned VF);
1196 unsigned getConsecutiveMemOpCost(Instruction *I, unsigned VF);
1202 unsigned getUniformMemOpCost(Instruction *I, unsigned VF);
1271 unsigned VF);
1282 void collectLoopUniforms(unsigned VF);
1289 void collectLoopScalars(unsigned VF);
1505 Value *Shuf = Builder.CreateVectorSplat(VF, V, "broadcast"); in getBroadcastInstrs()
1526 Value *SplatStart = Builder.CreateVectorSplat(VF, Start); in createVectorIntOrFpInductionPHI()
1544 Value *ConstVF = getSignedIntOrFpConstant(Step->getType(), VF); in createVectorIntOrFpInductionPHI()
1553 ? ConstantVector::getSplat(VF, cast<Constant>(Mul)) in createVectorIntOrFpInductionPHI()
1554 : Builder.CreateVectorSplat(VF, Mul); in createVectorIntOrFpInductionPHI()
1588 return Cost->isScalarAfterVectorization(I, VF) || in shouldScalarizeInstruction()
1589 Cost->isProfitableToScalarize(I, VF); in shouldScalarizeInstruction()
1654 auto NeedsScalarIV = VF > 1 && needsScalarInduction(EntryVal); in widenIntOrFpInduction()
1673 if (VF > 1 && !shouldScalarizeInstruction(EntryVal)) { in widenIntOrFpInduction()
1709 getStepVector(Broadcasted, VF * Part, Step, ID.getInductionOpcode()); in widenIntOrFpInduction()
1787 assert(VF > 1 && "VF should be greater than one"); in buildScalarSteps()
1810 Cost->isUniformAfterVectorization(cast<Instruction>(EntryVal), VF) ? 1 in buildScalarSteps()
1811 : VF; in buildScalarSteps()
1815 auto *StartIdx = getSignedIntOrFpConstant(ScalarIVTy, VF * Part + Lane); in buildScalarSteps()
1849 if (VF == 1) { in getOrCreateVectorValue()
1858 unsigned LastLane = Cost->isUniformAfterVectorization(I, VF) ? 0 : VF - 1; in getOrCreateVectorValue()
1875 if (Cost->isUniformAfterVectorization(I, VF)) { in getOrCreateVectorValue()
1880 Value *Undef = UndefValue::get(VectorType::get(V->getType(), VF)); in getOrCreateVectorValue()
1882 for (unsigned Lane = 0; Lane < VF; ++Lane) in getOrCreateVectorValue()
1906 ? !Cost->isUniformAfterVectorization(cast<Instruction>(V), VF) in getOrCreateScalarValue()
1921 assert(VF == 1 && "Value not scalarized has non-vector type"); in getOrCreateScalarValue()
1947 for (unsigned i = 0; i < VF; ++i) in reverseVector()
1948 ShuffleMask.push_back(Builder.getInt32(VF - i - 1)); in reverseVector()
2010 Type *VecTy = VectorType::get(ScalarTy, InterleaveFactor * VF); in vectorizeInterleaveGroup()
2034 Index += (VF - 1) * Group->getFactor(); in vectorizeInterleaveGroup()
2067 MaskForGaps = createBitMaskForGaps(Builder, VF, *Group); in vectorizeInterleaveGroup()
2083 auto *RepMask = createReplicatedMask(Builder, InterleaveFactor, VF); in vectorizeInterleaveGroup()
2111 Constant *StrideMask = createStrideMask(Builder, I, InterleaveFactor, VF); in vectorizeInterleaveGroup()
2118 VectorType *OtherVTy = VectorType::get(Member->getType(), VF); in vectorizeInterleaveGroup()
2132 VectorType *SubVT = VectorType::get(ScalarTy, VF); in vectorizeInterleaveGroup()
2160 Constant *IMask = createInterleaveMask(Builder, VF, InterleaveFactor); in vectorizeInterleaveGroup()
2167 auto *RepMask = createReplicatedMask(Builder, InterleaveFactor, VF); in vectorizeInterleaveGroup()
2190 Cost->getWideningDecision(Instr, VF); in vectorizeMemoryInstruction()
2197 Type *DataTy = VectorType::get(ScalarDataTy, VF); in vectorizeMemoryInstruction()
2242 Builder.CreateGEP(Ptr, Builder.getInt32(-Part * VF))); in vectorizeMemoryInstruction()
2245 Builder.CreateGEP(PartPtr, Builder.getInt32(1 - VF))); in vectorizeMemoryInstruction()
2251 Builder.CreateGEP(Ptr, Builder.getInt32(Part * VF))); in vectorizeMemoryInstruction()
2444 Constant *Step = ConstantInt::get(Ty, VF * UF); in getOrCreateVectorTripCount()
2453 assert(isPowerOf2_32(VF * UF) && in getOrCreateVectorTripCount()
2455 TC = Builder.CreateAdd(TC, ConstantInt::get(Ty, VF * UF - 1), "n.rnd.up"); in getOrCreateVectorTripCount()
2472 if (VF > 1 && Cost->requiresScalarEpilogue()) { in getOrCreateVectorTripCount()
2485 unsigned VF = DstVTy->getNumElements(); in createBitOrPointerCast() local
2487 assert((VF == SrcVecTy->getNumElements()) && "Vector dimensions do not match"); in createBitOrPointerCast()
2507 VectorType *VecIntTy = VectorType::get(IntTy, VF); in createBitOrPointerCast()
2530 P, Count, ConstantInt::get(Count->getType(), VF * UF), in emitMinimumIterationCountCheck()
2806 Constant *Step = ConstantInt::get(IdxTy, VF * UF); in createVectorizedLoopSkeleton()
3027 static unsigned getScalarizationOverhead(Instruction *I, unsigned VF, in getScalarizationOverhead() argument
3029 if (VF == 1) in getScalarizationOverhead()
3033 Type *RetTy = ToVectorTy(I->getType(), VF); in getScalarizationOverhead()
3045 Cost += TTI.getOperandsScalarizationOverhead(Operands, VF); in getScalarizationOverhead()
3050 Cost += TTI.getOperandsScalarizationOverhead(Operands, VF); in getScalarizationOverhead()
3060 static unsigned getVectorCallCost(CallInst *CI, unsigned VF, in getVectorCallCost() argument
3076 if (VF == 1) in getVectorCallCost()
3080 Type *RetTy = ToVectorTy(ScalarRetTy, VF); in getVectorCallCost()
3082 Tys.push_back(ToVectorTy(ScalarTy, VF)); in getVectorCallCost()
3086 unsigned ScalarizationCost = getScalarizationOverhead(CI, VF, TTI); in getVectorCallCost()
3088 unsigned Cost = ScalarCallCost * VF + ScalarizationCost; in getVectorCallCost()
3093 if (!TLI || !TLI->isFunctionVectorizable(FnName, VF) || CI->isNoBuiltin()) in getVectorCallCost()
3108 static unsigned getVectorIntrinsicCost(CallInst *CI, unsigned VF, in getVectorIntrinsicCost() argument
3119 return TTI.getIntrinsicInstrCost(ID, CI->getType(), Operands, FMF, VF); in getVectorIntrinsicCost()
3262 if (VF > 1) in fixVectorizedLoop()
3378 if (VF > 1) { in fixFirstOrderRecurrence()
3381 UndefValue::get(VectorType::get(VectorInit->getType(), VF)), VectorInit, in fixFirstOrderRecurrence()
3382 Builder.getInt32(VF - 1), "vector.recur.init"); in fixFirstOrderRecurrence()
3413 SmallVector<Constant *, 8> ShuffleMask(VF); in fixFirstOrderRecurrence()
3414 ShuffleMask[0] = Builder.getInt32(VF - 1); in fixFirstOrderRecurrence()
3415 for (unsigned I = 1; I < VF; ++I) in fixFirstOrderRecurrence()
3416 ShuffleMask[I] = Builder.getInt32(I + VF - 1); in fixFirstOrderRecurrence()
3427 VF > 1 ? Builder.CreateShuffleVector(Incoming, PreviousPart, in fixFirstOrderRecurrence()
3442 if (VF > 1) { in fixFirstOrderRecurrence()
3445 ExtractForScalar, Builder.getInt32(VF - 1), "vector.recur.extract"); in fixFirstOrderRecurrence()
3453 if (VF > 1) in fixFirstOrderRecurrence()
3455 Incoming, Builder.getInt32(VF - 2), "vector.recur.extract.for.phi"); in fixFirstOrderRecurrence()
3517 if (VF == 1) { in fixReduction()
3521 Builder.CreateVectorSplat(VF, ReductionStartValue, "minmax.ident"); in fixReduction()
3527 if (VF == 1) { in fixReduction()
3533 Identity = ConstantVector::getSplat(VF, Iden); in fixReduction()
3570 if (VF > 1 && Phi->getType() != RdxDesc.getRecurrenceType()) { in fixReduction()
3571 Type *RdxVecTy = VectorType::get(RdxDesc.getRecurrenceType(), VF); in fixReduction()
3612 if (VF > 1) { in fixReduction()
3667 cast<Instruction>(IncomingValue), VF) in fixLCSSAPHIs()
3669 : VF - 1; in fixLCSSAPHIs()
3781 unsigned VF) { in widenPHIInstruction() argument
3789 (VF == 1) ? PN->getType() : VectorType::get(PN->getType(), VF); in widenPHIInstruction()
3808 (VF == 1) ? PN->getType() : VectorType::get(PN->getType(), VF); in widenPHIInstruction()
3842 unsigned Lanes = Cost->isUniformAfterVectorization(P, VF) ? 1 : VF; in widenPHIInstruction()
3847 Constant *Idx = ConstantInt::get(PtrInd->getType(), Lane + Part * VF); in widenPHIInstruction()
3891 if (VF > 1 && OrigLoop->hasLoopInvariantOperands(GEP)) { in widenInstruction()
3906 Value *EntryPart = Builder.CreateVectorSplat(VF, Clone); in widenInstruction()
3941 assert((VF == 1 || NewGEP->getType()->isVectorTy()) && in widenInstruction()
4058 (VF == 1) ? CI->getType() : VectorType::get(CI->getType(), VF); in widenInstruction()
4080 Type *RetTy = ToVectorTy(CI->getType(), VF); in widenInstruction()
4083 Tys.push_back(ToVectorTy(ArgOperand->getType(), VF)); in widenInstruction()
4091 unsigned CallCost = getVectorCallCost(CI, VF, *TTI, TLI, NeedToScalarize); in widenInstruction()
4093 ID && getVectorIntrinsicCost(CI, VF, *TTI, TLI) <= CallCost; in widenInstruction()
4112 if (VF > 1) in widenInstruction()
4113 TysForDecl[0] = VectorType::get(CI->getType()->getScalarType(), VF); in widenInstruction()
4117 StringRef VFnName = TLI->getVectorizedFunction(FnName, VF); in widenInstruction()
4171 void LoopVectorizationCostModel::collectLoopScalars(unsigned VF) { in collectLoopScalars() argument
4175 assert(VF >= 2 && Scalars.find(VF) == Scalars.end() && in collectLoopScalars()
4190 InstWidening WideningDecision = getWideningDecision(MemAccess, VF); in collectLoopScalars()
4244 Worklist.insert(Uniforms[VF].begin(), Uniforms[VF].end()); in collectLoopScalars()
4287 auto ForcedScalar = ForcedScalars.find(VF); in collectLoopScalars()
4354 Scalars[VF].insert(Worklist.begin(), Worklist.end()); in collectLoopScalars()
4357 bool LoopVectorizationCostModel::isScalarWithPredication(Instruction *I, unsigned VF) { in isScalarWithPredication() argument
4371 if (VF > 1) { in isScalarWithPredication()
4372 InstWidening WideningDecision = getWideningDecision(I, VF); in isScalarWithPredication()
4391 unsigned VF) { in interleavedAccessCanBeWidened() argument
4393 assert(getWideningDecision(I, VF) == CM_Unknown && in interleavedAccessCanBeWidened()
4420 unsigned VF) { in memoryInstructionCanBeWidened() argument
4441 if (hasIrregularType(ScalarTy, DL, VF)) in memoryInstructionCanBeWidened()
4447 void LoopVectorizationCostModel::collectLoopUniforms(unsigned VF) { in collectLoopUniforms() argument
4453 assert(VF >= 2 && Uniforms.find(VF) == Uniforms.end() && in collectLoopUniforms()
4458 Uniforms[VF].clear(); in collectLoopUniforms()
4492 auto isUniformDecision = [&](Instruction *I, unsigned VF) { in collectLoopUniforms() argument
4493 InstWidening WideningDecision = getWideningDecision(I, VF); in collectLoopUniforms()
4527 if (!UsersAreMemAccesses || !isUniformDecision(&I, VF)) in collectLoopUniforms()
4568 isUniformDecision(J, VF)); in collectLoopUniforms()
4579 return getLoadStorePointerOperand(I) == Ptr && isUniformDecision(I, VF); in collectLoopUniforms()
4621 Uniforms[VF].insert(Worklist.begin(), Worklist.end()); in collectLoopUniforms()
4908 unsigned VF, in selectInterleaveCount() argument
4937 unsigned TargetNumRegisters = TTI.getNumberOfRegisters(VF > 1); in selectInterleaveCount()
4941 if (VF == 1) { in selectInterleaveCount()
4949 RegisterUsage R = calculateRegisterUsage({VF})[0]; in selectInterleaveCount()
4974 unsigned MaxInterleaveCount = TTI.getMaxInterleaveFactor(VF); in selectInterleaveCount()
4977 if (VF == 1) { in selectInterleaveCount()
4988 LoopCost = expectedCost(VF).first; in selectInterleaveCount()
4999 if (VF > 1 && !Legal->getReductionVars()->empty()) { in selectInterleaveCount()
5007 (VF == 1 && Legal->getRuntimePointerChecking()->Need); in selectInterleaveCount()
5148 auto GetRegUsage = [&DL, WidestRegister](Type *Ty, unsigned VF) { in calculateRegisterUsage() argument
5152 return std::max<unsigned>(1, VF * TypeSize / WidestRegister); in calculateRegisterUsage()
5234 void LoopVectorizationCostModel::collectInstsToScalarize(unsigned VF) { in collectInstsToScalarize() argument
5239 if (VF < 2 || InstsToScalarize.find(VF) != InstsToScalarize.end()) in collectInstsToScalarize()
5245 ScalarCostsTy &ScalarCostsVF = InstsToScalarize[VF]; in collectInstsToScalarize()
5259 computePredInstDiscount(&I, ScalarCosts, VF) >= 0) in collectInstsToScalarize()
5269 unsigned VF) { in computePredInstDiscount() argument
5270 assert(!isUniformAfterVectorization(PredInst, VF) && in computePredInstDiscount()
5290 isScalarAfterVectorization(I, VF)) in computePredInstDiscount()
5310 if (isUniformAfterVectorization(J, VF)) in computePredInstDiscount()
5323 return TheLoop->contains(I) && !isScalarAfterVectorization(I, VF); in computePredInstDiscount()
5339 unsigned VectorCost = getInstructionCost(I, VF).first; in computePredInstDiscount()
5345 unsigned ScalarCost = VF * getInstructionCost(I, 1).first; in computePredInstDiscount()
5350 ScalarCost += TTI.getScalarizationOverhead(ToVectorTy(I->getType(), VF), in computePredInstDiscount()
5352 ScalarCost += VF * TTI.getCFInstrCost(Instruction::PHI); in computePredInstDiscount()
5367 ToVectorTy(J->getType(),VF), false, true); in computePredInstDiscount()
5383 LoopVectorizationCostModel::expectedCost(unsigned VF) { in expectedCost() argument
5394 (VF > 1 && VecValuesToIgnore.find(&I) != VecValuesToIgnore.end())) in expectedCost()
5397 VectorizationCostTy C = getInstructionCost(&I, VF); in expectedCost()
5406 << " for VF " << VF << " For instruction: " << I in expectedCost()
5416 if (VF == 1 && blockNeedsPredication(BB)) in expectedCost()
5462 unsigned VF) { in getMemInstScalarizationCost() argument
5463 assert(VF > 1 && "Scalarization cost of instruction implies vectorization."); in getMemInstScalarizationCost()
5470 Type *PtrTy = ToVectorTy(Ptr->getType(), VF); in getMemInstScalarizationCost()
5477 unsigned Cost = VF * TTI.getAddressComputationCost(PtrTy, SE, PtrSCEV); in getMemInstScalarizationCost()
5481 Cost += VF * in getMemInstScalarizationCost()
5487 Cost += getScalarizationOverhead(I, VF, TTI); in getMemInstScalarizationCost()
5505 unsigned VF) { in getConsecutiveMemOpCost() argument
5507 Type *VectorTy = ToVectorTy(ValTy, VF); in getConsecutiveMemOpCost()
5528 unsigned VF) { in getUniformMemOpCost() argument
5530 Type *VectorTy = ToVectorTy(ValTy, VF); in getUniformMemOpCost()
5545 VectorTy, VF - 1)); in getUniformMemOpCost()
5549 unsigned VF) { in getGatherScatterCost() argument
5551 Type *VectorTy = ToVectorTy(ValTy, VF); in getGatherScatterCost()
5561 unsigned VF) { in getInterleaveGroupCost() argument
5563 Type *VectorTy = ToVectorTy(ValTy, VF); in getInterleaveGroupCost()
5570 Type *WideVecTy = VectorType::get(ValTy, VF * InterleaveFactor); in getInterleaveGroupCost()
5599 unsigned VF) { in getMemoryInstructionCost() argument
5602 if (VF == 1) { in getMemoryInstructionCost()
5610 return getWideningCost(I, VF); in getMemoryInstructionCost()
5614 LoopVectorizationCostModel::getInstructionCost(Instruction *I, unsigned VF) { in getInstructionCost() argument
5617 if (isUniformAfterVectorization(I, VF)) in getInstructionCost()
5618 VF = 1; in getInstructionCost()
5620 if (VF > 1 && isProfitableToScalarize(I, VF)) in getInstructionCost()
5621 return VectorizationCostTy(InstsToScalarize[VF][I], false); in getInstructionCost()
5624 auto ForcedScalar = ForcedScalars.find(VF); in getInstructionCost()
5625 if (VF > 1 && ForcedScalar != ForcedScalars.end()) { in getInstructionCost()
5628 return VectorizationCostTy((getInstructionCost(I, 1).first * VF), false); in getInstructionCost()
5632 unsigned C = getInstructionCost(I, VF, VectorTy); in getInstructionCost()
5635 VF > 1 && VectorTy->isVectorTy() && TTI.getNumberOfParts(VectorTy) < VF; in getInstructionCost()
5639 void LoopVectorizationCostModel::setCostBasedWideningDecision(unsigned VF) { in setCostBasedWideningDecision() argument
5640 if (VF == 1) in setCostBasedWideningDecision()
5666 unsigned Cost = getUniformMemOpCost(&I, VF); in setCostBasedWideningDecision()
5667 setWideningDecision(&I, VF, CM_Scalarize, Cost); in setCostBasedWideningDecision()
5672 if (memoryInstructionCanBeWidened(&I, VF)) { in setCostBasedWideningDecision()
5673 unsigned Cost = getConsecutiveMemOpCost(&I, VF); in setCostBasedWideningDecision()
5680 setWideningDecision(&I, VF, Decision, Cost); in setCostBasedWideningDecision()
5692 if (getWideningDecision(&I, VF) != CM_Unknown) in setCostBasedWideningDecision()
5696 if (interleavedAccessCanBeWidened(&I, VF)) in setCostBasedWideningDecision()
5697 InterleaveCost = getInterleaveGroupCost(&I, VF); in setCostBasedWideningDecision()
5702 ? getGatherScatterCost(&I, VF) * NumAccesses in setCostBasedWideningDecision()
5706 getMemInstScalarizationCost(&I, VF) * NumAccesses; in setCostBasedWideningDecision()
5727 setWideningDecision(Group, VF, Decision, Cost); in setCostBasedWideningDecision()
5729 setWideningDecision(&I, VF, Decision, Cost); in setCostBasedWideningDecision()
5748 getWideningDecision(&I, VF) != CM_GatherScatter) in setCostBasedWideningDecision()
5771 InstWidening Decision = getWideningDecision(I, VF); in setCostBasedWideningDecision()
5774 setWideningDecision(I, VF, CM_Scalarize, in setCostBasedWideningDecision()
5775 (VF * getMemoryInstructionCost(I, 1))); in setCostBasedWideningDecision()
5780 setWideningDecision(Member, VF, CM_Scalarize, in setCostBasedWideningDecision()
5781 (VF * getMemoryInstructionCost(Member, 1))); in setCostBasedWideningDecision()
5787 ForcedScalars[VF].insert(I); in setCostBasedWideningDecision()
5792 unsigned VF, in getInstructionCost() argument
5795 if (canTruncateToMinimalBitwidth(I, VF)) in getInstructionCost()
5797 VectorTy = isScalarAfterVectorization(I, VF) ? RetTy : ToVectorTy(RetTy, VF); in getInstructionCost()
5814 if (VF > 1 && BI->isConditional() && in getInstructionCost()
5824 VectorType::get(IntegerType::getInt1Ty(RetTy->getContext()), VF); in getInstructionCost()
5826 (TTI.getCFInstrCost(Instruction::Br) * VF)); in getInstructionCost()
5827 } else if (I->getParent() == TheLoop->getLoopLatch() || VF == 1) in getInstructionCost()
5842 if (VF > 1 && Legal->isFirstOrderRecurrence(Phi)) in getInstructionCost()
5844 VectorTy, VF - 1, VectorType::get(RetTy, 1)); in getInstructionCost()
5849 if (VF > 1 && Phi->getParent() != TheLoop->getHeader()) in getInstructionCost()
5852 Instruction::Select, ToVectorTy(Phi->getType(), VF), in getInstructionCost()
5853 ToVectorTy(Type::getInt1Ty(Phi->getContext()), VF)); in getInstructionCost()
5865 if (VF > 1 && isScalarWithPredication(I)) { in getInstructionCost()
5872 Cost += VF * TTI.getCFInstrCost(Instruction::PHI); in getInstructionCost()
5875 Cost += VF * TTI.getArithmeticInstrCost(I->getOpcode(), RetTy); in getInstructionCost()
5879 Cost += getScalarizationOverhead(I, VF, TTI); in getInstructionCost()
5914 unsigned N = isScalarAfterVectorization(I, VF) ? VF : 1; in getInstructionCost()
5925 CondTy = VectorType::get(CondTy, VF); in getInstructionCost()
5933 if (canTruncateToMinimalBitwidth(Op0AsInstruction, VF)) in getInstructionCost()
5935 VectorTy = ToVectorTy(ValTy, VF); in getInstructionCost()
5940 unsigned Width = VF; in getInstructionCost()
5949 return getMemoryInstructionCost(I, VF); in getInstructionCost()
5966 if (isOptimizableIVTruncate(I, VF)) { in getInstructionCost()
5974 VectorTy->isVectorTy() ? ToVectorTy(SrcScalarTy, VF) : SrcScalarTy; in getInstructionCost()
5975 if (canTruncateToMinimalBitwidth(I, VF)) { in getInstructionCost()
5985 largestIntegerVectorType(ToVectorTy(I->getType(), VF), MinVecTy); in getInstructionCost()
5990 smallestIntegerVectorType(ToVectorTy(I->getType(), VF), MinVecTy); in getInstructionCost()
5994 unsigned N = isScalarAfterVectorization(I, VF) ? VF : 1; in getInstructionCost()
6000 unsigned CallCost = getVectorCallCost(CI, VF, TTI, TLI, NeedToScalarize); in getInstructionCost()
6002 return std::min(CallCost, getVectorIntrinsicCost(CI, VF, TTI, TLI)); in getInstructionCost()
6008 return VF * TTI.getArithmeticInstrCost(Instruction::Mul, VectorTy) + in getInstructionCost()
6009 getScalarizationOverhead(I, VF, TTI); in getInstructionCost()
6138 for (unsigned VF = 1; VF <= MaxVF; VF *= 2) { in plan() local
6140 CM.collectUniformsAndScalars(VF); in plan()
6144 if (VF > 1) in plan()
6145 CM.collectInstsToScalarize(VF); in plan()
6157 void LoopVectorizationPlanner::setBestPlan(unsigned VF, unsigned UF) { in setBestPlan() argument
6158 LLVM_DEBUG(dbgs() << "Setting best plan to VF=" << VF << ", UF=" << UF in setBestPlan()
6160 BestVF = VF; in setBestPlan()
6163 erase_if(VPlans, [VF](const VPlanPtr &Plan) { in setBestPlan()
6164 return !Plan->hasVF(VF); in setBestPlan()
6311 for (unsigned VF = MinVF; VF < MaxVF + 1;) { in buildVPlans() local
6312 VFRange SubRange = {VF, MaxVF + 1}; in buildVPlans()
6314 VF = SubRange.End; in buildVPlans()
6399 return [=](unsigned VF) -> bool { in tryToInterleaveMemory() argument
6400 return (VF >= 2 && // Query is illegal for VF == 1 in tryToInterleaveMemory()
6401 CM.getWideningDecision(I, VF) == in tryToInterleaveMemory()
6427 auto willWiden = [&](unsigned VF) -> bool { in tryToWidenMemory() argument
6428 if (VF == 1) in tryToWidenMemory()
6430 if (CM.isScalarAfterVectorization(I, VF) || in tryToWidenMemory()
6431 CM.isProfitableToScalarize(I, VF)) in tryToWidenMemory()
6434 CM.getWideningDecision(I, VF); in tryToWidenMemory()
6475 [=](unsigned VF) -> bool { return CM.isOptimizableIVTruncate(K, VF); }; in tryToOptimizeInduction() argument
6513 [&](unsigned VF) { return CM.isScalarWithPredication(I, VF); }, Range); in tryToWiden() argument
6574 auto willWiden = [&](unsigned VF) -> bool { in tryToWiden() argument
6575 if (!isa<PHINode>(I) && (CM.isScalarAfterVectorization(I, VF) || in tryToWiden()
6576 CM.isProfitableToScalarize(I, VF))) in tryToWiden()
6585 unsigned CallCost = getVectorCallCost(CI, VF, *TTI, TLI, NeedToScalarize); in tryToWiden()
6587 ID && getVectorIntrinsicCost(CI, VF, *TTI, TLI) <= CallCost; in tryToWiden()
6591 assert(CM.getWideningDecision(I, VF) == in tryToWiden()
6619 [&](unsigned VF) { return CM.isUniformAfterVectorization(I, VF); }, in handleReplication() argument
6623 [&](unsigned VF) { return CM.isScalarWithPredication(I, VF); }, Range); in handleReplication() argument
6751 for (unsigned VF = MinVF; VF < MaxVF + 1;) { in buildVPlansWithVPRecipes() local
6752 VFRange SubRange = {VF, MaxVF + 1}; in buildVPlansWithVPRecipes()
6755 VF = SubRange.End; in buildVPlansWithVPRecipes()
6870 unsigned VF = Range.Start; in buildVPlanWithVPRecipes() local
6871 Plan->addVF(VF); in buildVPlanWithVPRecipes()
6872 RSO << "Initial VPlan for VF={" << VF; in buildVPlanWithVPRecipes()
6873 for (VF *= 2; VF < Range.End; VF *= 2) { in buildVPlanWithVPRecipes()
6874 Plan->addVF(VF); in buildVPlanWithVPRecipes()
6875 RSO << "," << VF; in buildVPlanWithVPRecipes()
6904 for (unsigned VF = Range.Start; VF < Range.End; VF *= 2) in buildVPlan() local
6905 Plan->addVF(VF); in buildVPlan()
6941 State.ILV->widenPHIInstruction(Phi, State.UF, State.VF); in execute()
7000 if (AlsoPack && State.VF > 1) { in execute()
7004 UndefValue::get(VectorType::get(Ingredient->getType(), State.VF)); in execute()
7015 unsigned EndLane = IsUniform ? 1 : State.VF; in execute()
7120 VectorizationFactor VF = LVP.planInVPlanNativePath(OptForSize, UserVF); in processLoopInVPlanNativePath() local
7127 LVP.setBestPlan(VF.Width, 1); in processLoopInVPlanNativePath()
7307 VectorizationFactor VF = LVP.plan(OptForSize, UserVF); in processLoop() local
7310 unsigned IC = CM.selectInterleaveCount(OptForSize, VF.Width, VF.Cost); in processLoop()
7325 if (VF.Width == 1) { in processLoop()
7382 LLVM_DEBUG(dbgs() << "LV: Found a vectorizable loop (" << VF.Width in processLoop()
7390 LLVM_DEBUG(dbgs() << "LV: Found a vectorizable loop (" << VF.Width in processLoop()
7395 LVP.setBestPlan(VF.Width, IC); in processLoop()
7417 InnerLoopVectorizer LB(L, PSE, LI, DT, TLI, TTI, AC, ORE, VF.Width, IC, in processLoop()
7433 << NV("VectorizationFactor", VF.Width) in processLoop()