Home
last modified time | relevance | path

Searched refs:Weights (Results 1 – 25 of 33) sorted by relevance

12

/openbsd/gnu/llvm/llvm/lib/IR/
H A DProfDataUtils.cpp49 SmallVectorImpl<uint32_t> &Weights) { in extractWeights() argument
55 Weights.resize(NOps - WeightsIdx); in extractWeights()
63 Weights[Idx - WeightsIdx] = Weight->getZExtValue(); in extractWeights()
123 SmallVectorImpl<uint32_t> &Weights) { in extractBranchWeights() argument
126 return extractWeights(ProfileData, Weights); in extractBranchWeights()
132 return extractBranchWeights(ProfileData, Weights); in extractBranchWeights()
142 SmallVector<uint32_t, 2> Weights; in extractBranchWeights() local
144 if (!extractBranchWeights(ProfileData, Weights)) in extractBranchWeights()
147 if (Weights.size() > 2) in extractBranchWeights()
150 TrueVal = Weights[0]; in extractBranchWeights()
[all …]
H A DMDBuilder.cpp42 MDNode *MDBuilder::createBranchWeights(ArrayRef<uint32_t> Weights) { in createBranchWeights() argument
43 assert(Weights.size() >= 1 && "Need at least one branch weights!"); in createBranchWeights()
45 SmallVector<Metadata *, 4> Vals(Weights.size() + 1); in createBranchWeights()
49 for (unsigned i = 0, e = Weights.size(); i != e; ++i) in createBranchWeights()
50 Vals[i + 1] = createConstant(ConstantInt::get(Int32Ty, Weights[i])); in createBranchWeights()
H A DInstructions.cpp4583 if (!Weights) in buildProfBranchWeightsMD()
4610 this->Weights = std::move(Weights); in init()
4615 if (Weights) { in removeCase()
4622 (*Weights)[I->getCaseIndex() + 1] = Weights->back(); in removeCase()
4637 } else if (Weights) { in addCase()
4641 if (Weights) in addCase()
4650 if (Weights) in eraseFromParent()
4651 Weights->resize(0); in eraseFromParent()
4657 if (!Weights) in getSuccessorWeight()
4667 if (!Weights && *W) in setSuccessorWeight()
[all …]
/openbsd/gnu/llvm/llvm/lib/Analysis/
H A DBlockFrequencyInfoImpl.cpp195 Weights.erase(O, Weights.end()); in combineWeightsBySorting()
211 Weights.clear(); in combineWeightsByHashing()
214 Weights.push_back(I.second); in combineWeightsByHashing()
219 if (Weights.size() > 128) { in combineWeights()
237 if (Weights.empty()) in normalize()
241 if (Weights.size() > 1) in normalize()
242 combineWeights(Weights); in normalize()
245 if (Weights.size() == 1) { in normalize()
247 Weights.front().Amount = 1; in normalize()
265 assert(Total == std::accumulate(Weights.begin(), Weights.end(), UINT64_C(0), in normalize()
[all …]
H A DBranchProbabilityInfo.cpp397 SmallVector<uint32_t, 2> Weights; in calcMetadataWeights() local
401 extractBranchWeights(WeightsNode, Weights); in calcMetadataWeights()
402 for (unsigned I = 0, E = Weights.size(); I != E; ++I) { in calcMetadataWeights()
403 WeightSum += Weights[I]; in calcMetadataWeights()
413 assert(Weights.size() == TI->getNumSuccessors() && "Checked above"); in calcMetadataWeights()
423 Weights[I] /= ScalingFactor; in calcMetadataWeights()
424 WeightSum += Weights[I]; in calcMetadataWeights()
432 Weights[I] = 1; in calcMetadataWeights()
439 BP.push_back({ Weights[I], static_cast<uint32_t>(WeightSum) }); in calcMetadataWeights()
673 SmallVector<uint32_t, 4> Weights; in getMaxEstimatedEdgeWeight() local
/openbsd/gnu/llvm/llvm/lib/Transforms/Utils/
H A DLoopPeel.cpp598 SmallVector<uint32_t> Weights; member
619 MDB.createBranchWeights(Info.Weights)); in updateBranchWeights()
622 Info.Weights[Idx] = Info.Weights[Idx] > SubWeight in updateBranchWeights()
623 ? Info.Weights[Idx] - SubWeight in updateBranchWeights()
634 SmallVector<uint32_t> Weights; in initBranchWeights() local
635 if (!extractBranchWeights(*Term, Weights)) in initBranchWeights()
676 MDB.createBranchWeights(Info.Weights)); in fixupBranchWeights()
954 DenseMap<Instruction *, WeightInfo> Weights; in peelLoop() local
955 initBranchWeights(Weights, L); in peelLoop()
984 for (auto &[Term, Info] : Weights) { in peelLoop()
[all …]
H A DSimplifyCFG.cpp1081 std::swap(Weights.front(), Weights.back()); in GetBranchWeights()
1087 uint64_t Max = *std::max_element(Weights.begin(), Weights.end()); in FitWeights()
1090 for (uint64_t &I : Weights) in FitWeights()
1216 Weights[0] += Weights[i + 1]; in PerformValueComparisonIntoPredecessorFolding()
1217 std::swap(Weights[i + 1], Weights.back()); in PerformValueComparisonIntoPredecessorFolding()
1218 Weights.pop_back(); in PerformValueComparisonIntoPredecessorFolding()
1245 Weights.push_back(Weights[0] * SuccWeights[i + 1]); in PerformValueComparisonIntoPredecessorFolding()
1270 std::swap(Weights[i + 1], Weights.back()); in PerformValueComparisonIntoPredecessorFolding()
1271 Weights.pop_back(); in PerformValueComparisonIntoPredecessorFolding()
1335 FitWeights(Weights); in PerformValueComparisonIntoPredecessorFolding()
[all …]
H A DLocal.cpp220 SmallVector<uint32_t, 8> Weights; in ConstantFoldTerminator() local
221 extractBranchWeights(MD, Weights); in ConstantFoldTerminator()
226 Weights[0] += Weights[idx+1]; in ConstantFoldTerminator()
228 std::swap(Weights[idx+1], Weights.back()); in ConstantFoldTerminator()
229 Weights.pop_back(); in ConstantFoldTerminator()
232 createBranchWeights(Weights)); in ConstantFoldTerminator()
315 SmallVector<uint32_t> Weights; in ConstantFoldTerminator() local
316 if (extractBranchWeights(*SI, Weights) && Weights.size() == 2) { in ConstantFoldTerminator()
317 uint32_t DefWeight = Weights[0]; in ConstantFoldTerminator()
318 uint32_t CaseWeight = Weights[1]; in ConstantFoldTerminator()
/openbsd/gnu/llvm/compiler-rt/lib/fuzzer/
H A DFuzzerCorpus.h508 Weights.resize(N); in UpdateCorpusDistribution()
531 Weights[i] = 0.; in UpdateCorpusDistribution()
535 Weights[i] = 0.; in UpdateCorpusDistribution()
538 Weights[i] = Inputs[i]->Energy; in UpdateCorpusDistribution()
542 if (Weights[i] > 0.0) in UpdateCorpusDistribution()
549 Weights[i] = in UpdateCorpusDistribution()
561 Printf("%f ", Weights[i]); in UpdateCorpusDistribution()
565 Intervals.begin(), Intervals.end(), Weights.begin()); in UpdateCorpusDistribution()
570 std::vector<double> Weights; variable
H A DFuzzerDataFlowTrace.cpp193 auto Weights = Coverage.FunctionWeights(NumFunctions); in Init() local
197 Intervals.begin(), Intervals.end(), Weights.begin()); in Init()
204 if (Weights[i] == 0.0) in Init()
207 Weights[i], Coverage.GetNumberOfBlocks(i), in Init()
/openbsd/gnu/llvm/llvm/include/llvm/IR/
H A DProfDataUtils.h65 SmallVectorImpl<uint32_t> &Weights);
74 SmallVectorImpl<uint32_t> &Weights);
H A DMDBuilder.h65 MDNode *createBranchWeights(ArrayRef<uint32_t> Weights);
/openbsd/gnu/llvm/llvm/lib/Transforms/Scalar/
H A DLowerExpectIntrinsic.cpp100 SmallVector<uint32_t, 16> Weights(n + 1, UnlikelyBranchWeightVal); in handleSwitchExpect() local
103 Weights[Index] = LikelyBranchWeightVal; in handleSwitchExpect()
105 misexpect::checkExpectAnnotations(SI, Weights, /*IsFrontend=*/true); in handleSwitchExpect()
110 MDBuilder(CI->getContext()).createBranchWeights(Weights)); in handleSwitchExpect()
H A DJumpThreading.cpp295 SmallVector<uint32_t, 2> Weights; in updatePredecessorProfileMetadata() local
297 Weights.push_back(BP.getNumerator()); in updatePredecessorProfileMetadata()
298 Weights.push_back(BP.getCompl().getNumerator()); in updatePredecessorProfileMetadata()
300 Weights.push_back(BP.getCompl().getNumerator()); in updatePredecessorProfileMetadata()
301 Weights.push_back(BP.getNumerator()); in updatePredecessorProfileMetadata()
305 .createBranchWeights(Weights)); in updatePredecessorProfileMetadata()
2612 SmallVector<uint32_t, 4> Weights; in updateBlockFreqAndEdgeWeight() local
2614 Weights.push_back(Prob.getNumerator()); in updateBlockFreqAndEdgeWeight()
2619 MDBuilder(TI->getParent()->getContext()).createBranchWeights(Weights)); in updateBlockFreqAndEdgeWeight()
H A DLoopPredication.cpp989 SmallVector<uint32_t> Weights; in isLoopProfitableToPredicate() local
990 extractBranchWeights(ProfileData, Weights); in isLoopProfitableToPredicate()
992 for (auto [i, Weight] : llvm::enumerate(Weights)) { in isLoopProfitableToPredicate()
/openbsd/gnu/llvm/compiler-rt/lib/fuzzer/tests/
H A DFuzzerUnittest.cpp1144 auto Weights = Cov.FunctionWeights(2); in TEST() local
1145 EXPECT_GT(Weights[0], 0.); in TEST()
1146 EXPECT_EQ(Weights[1], 0.); in TEST()
1151 Weights = Cov.FunctionWeights(2); in TEST()
1152 EXPECT_GT(Weights[0], Weights[1]); in TEST()
1157 Weights = Cov.FunctionWeights(2); in TEST()
1158 EXPECT_GT(Weights[1], Weights[0]); in TEST()
1163 Weights = Cov.FunctionWeights(2); in TEST()
1164 EXPECT_GT(Weights[1], Weights[0]); in TEST()
/openbsd/gnu/llvm/clang/lib/CodeGen/
H A DCodeGenPGO.cpp1093 CodeGenFunction::createProfileWeights(ArrayRef<uint64_t> Weights) const { in createProfileWeights()
1095 if (Weights.size() < 2) in createProfileWeights()
1099 uint64_t MaxWeight = *std::max_element(Weights.begin(), Weights.end()); in createProfileWeights()
1107 ScaledWeights.reserve(Weights.size()); in createProfileWeights()
1108 for (uint64_t W : Weights) in createProfileWeights()
H A DCGStmt.cpp914 llvm::MDNode *Weights = in EmitWhileStmt() local
916 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitWhileStmt()
1094 llvm::MDNode *Weights = in EmitForStmt() local
1096 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitForStmt()
1100 Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights); in EmitForStmt()
1179 llvm::MDNode *Weights = in EmitCXXForRangeStmt() local
1181 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitCXXForRangeStmt()
1184 Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights); in EmitCXXForRangeStmt()
1481 llvm::MDNode *Weights = nullptr; in EmitCaseStmtRange() local
1485 Weights = createProfileWeights(ThisCount, DefaultCount); in EmitCaseStmtRange()
[all …]
H A DCGDeclCXX.cpp402 llvm::MDNode *Weights; in EmitCXXGuardedInitBranch() local
408 Weights = nullptr; in EmitCXXGuardedInitBranch()
421 Weights = MDHelper.createBranchWeights(1, NumInits - 1); in EmitCXXGuardedInitBranch()
424 Builder.CreateCondBr(NeedsInit, InitBlock, NoInitBlock, Weights); in EmitCXXGuardedInitBranch()
/openbsd/gnu/llvm/llvm/lib/CodeGen/
H A DStackProtector.cpp561 MDNode *Weights = MDBuilder(F->getContext()) in InsertStackProtectors() local
566 /*Unreachable=*/false, Weights, in InsertStackProtectors()
H A DSafeStack.cpp473 MDNode *Weights = MDBuilder(F.getContext()) in checkStackGuard() local
477 SplitBlockAndInsertIfThen(Cmp, &RI, /* Unreachable */ true, Weights, DTU); in checkStackGuard()
/openbsd/gnu/llvm/llvm/lib/Transforms/Instrumentation/
H A DPGOInstrumentation.cpp2302 SmallVector<unsigned, 4> Weights; in setProfMetadata() local
2304 Weights.push_back(scaleBranchCount(ECI, Scale)); in setProfMetadata()
2307 : Weights) { in setProfMetadata()
2311 misexpect::checkExpectAnnotations(*TI, Weights, /*IsFrontend=*/false); in setProfMetadata()
2313 TI->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in setProfMetadata()
2320 std::accumulate(Weights.begin(), Weights.end(), (uint64_t)0, in setProfMetadata()
2326 BranchProbability BP(scaleBranchCount(Weights[0], Scale), in setProfMetadata()
H A DControlHeightReduction.cpp1871 uint32_t Weights[] = { in fixupBranchesAndSelects() local
1876 MergedBR->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in fixupBranchesAndSelects()
1877 CHR_DEBUG(dbgs() << "CHR branch bias " << Weights[0] << ":" << Weights[1] in fixupBranchesAndSelects()
/openbsd/gnu/llvm/llvm/lib/Transforms/IPO/
H A DSampleProfile.cpp1694 SmallVector<uint32_t, 4> Weights; in generateMDProfMetadata() local
1725 Weights.push_back(static_cast<uint32_t>(Weight + 1)); in generateMDProfMetadata()
1733 Weights.push_back(static_cast<uint32_t>(W)); in generateMDProfMetadata()
1743 misexpect::checkExpectAnnotations(*TI, Weights, /*IsFrontend=*/false); in generateMDProfMetadata()
1757 TI->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in generateMDProfMetadata()
/openbsd/gnu/llvm/llvm/docs/
H A DBlockFrequencyTerminology.rst26 Weights are relative to the other edges of a given predecessor block. The

12