Home
last modified time | relevance | path

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

12

/freebsd/contrib/llvm-project/llvm/lib/IR/
H A DProfDataUtils.cpp109 Weights.resize(NOps - WeightsIdx); in extractFromBranchWeightMD()
117 Weights[Idx - WeightsIdx] = Weight->getZExtValue(); in extractFromBranchWeightMD()
122 SmallVectorImpl<uint32_t> &Weights) { in extractBranchWeights() argument
125 extractFromBranchWeightMD(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()
151 FalseVal = Weights[1]; 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.cpp4567 if (!Weights) in buildProfBranchWeightsMD()
4594 this->Weights = std::move(Weights); in init()
4599 if (Weights) { in removeCase()
4606 (*Weights)[I->getCaseIndex() + 1] = Weights->back(); in removeCase()
4621 } else if (Weights) { in addCase()
4625 if (Weights) in addCase()
4634 if (Weights) in eraseFromParent()
4635 Weights->resize(0); in eraseFromParent()
4641 if (!Weights) in getSuccessorWeight()
4651 if (!Weights && *W) in setSuccessorWeight()
[all …]
/freebsd/contrib/llvm-project/llvm/lib/Analysis/
H A DBlockFrequencyInfoImpl.cpp196 Weights.erase(O, Weights.end()); in combineWeightsBySorting()
212 Weights.clear(); in combineWeightsByHashing()
215 Weights.push_back(I.second); in combineWeightsByHashing()
220 if (Weights.size() > 128) { in combineWeights()
238 if (Weights.empty()) in normalize()
242 if (Weights.size() > 1) in normalize()
243 combineWeights(Weights); in normalize()
246 if (Weights.size() == 1) { in normalize()
248 Weights.front().Amount = 1; in normalize()
266 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
/freebsd/contrib/llvm-project/llvm/include/llvm/IR/
H A DProfDataUtils.h65 SmallVectorImpl<uint32_t> &Weights);
70 SmallVectorImpl<uint32_t> &Weights);
79 SmallVectorImpl<uint32_t> &Weights);
109 void setBranchWeights(Instruction &I, ArrayRef<uint32_t> Weights);
H A DMDBuilder.h65 MDNode *createBranchWeights(ArrayRef<uint32_t> Weights);
/freebsd/contrib/llvm-project/llvm/lib/Transforms/Utils/
H A DLoopPeel.cpp624 SmallVector<uint32_t> Weights; member
643 setBranchWeights(*Term, Info.Weights); in updateBranchWeights()
650 Info.Weights[Idx] = in updateBranchWeights()
651 Info.Weights[Idx] > SubWeight in updateBranchWeights()
663 SmallVector<uint32_t> Weights; in initBranchWeights() local
664 if (!extractBranchWeights(*Term, Weights)) in initBranchWeights()
975 DenseMap<Instruction *, WeightInfo> Weights; in peelLoop() local
976 initBranchWeights(Weights, L); in peelLoop()
1005 for (auto &[Term, Info] : Weights) { in peelLoop()
1035 for (const 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()
1220 Weights[0] += Weights[i + 1]; in PerformValueComparisonIntoPredecessorFolding()
1221 std::swap(Weights[i + 1], Weights.back()); in PerformValueComparisonIntoPredecessorFolding()
1222 Weights.pop_back(); in PerformValueComparisonIntoPredecessorFolding()
1249 Weights.push_back(Weights[0] * SuccWeights[i + 1]); in PerformValueComparisonIntoPredecessorFolding()
1274 std::swap(Weights[i + 1], Weights.back()); in PerformValueComparisonIntoPredecessorFolding()
1275 Weights.pop_back(); in PerformValueComparisonIntoPredecessorFolding()
1339 FitWeights(Weights); in PerformValueComparisonIntoPredecessorFolding()
[all …]
H A DLoopRotationUtils.cpp289 SmallVector<uint32_t, 2> Weights; in updateBranchWeights() local
290 extractFromBranchWeightMD(WeightMD, Weights); in updateBranchWeights()
291 if (Weights.size() != 2) in updateBranchWeights()
293 uint32_t OrigLoopExitWeight = Weights[0]; in updateBranchWeights()
294 uint32_t OrigLoopBackedgeWeight = Weights[1]; in updateBranchWeights()
H A DLocal.cpp223 SmallVector<uint32_t, 8> Weights; in ConstantFoldTerminator() local
224 extractBranchWeights(MD, Weights); in ConstantFoldTerminator()
229 Weights[0] += Weights[Idx + 1]; in ConstantFoldTerminator()
231 std::swap(Weights[Idx + 1], Weights.back()); in ConstantFoldTerminator()
232 Weights.pop_back(); in ConstantFoldTerminator()
233 setBranchWeights(*SI, Weights); in ConstantFoldTerminator()
316 SmallVector<uint32_t> Weights; in ConstantFoldTerminator() local
317 if (extractBranchWeights(*SI, Weights) && Weights.size() == 2) { in ConstantFoldTerminator()
318 uint32_t DefWeight = Weights[0]; in ConstantFoldTerminator()
319 uint32_t CaseWeight = Weights[1]; in ConstantFoldTerminator()
/freebsd/contrib/llvm-project/compiler-rt/lib/fuzzer/
H A DFuzzerCorpus.h509 Weights.resize(N); in UpdateCorpusDistribution()
532 Weights[i] = 0.; in UpdateCorpusDistribution()
536 Weights[i] = 0.; in UpdateCorpusDistribution()
539 Weights[i] = Inputs[i]->Energy; in UpdateCorpusDistribution()
543 if (Weights[i] > 0.0) in UpdateCorpusDistribution()
550 Weights[i] = in UpdateCorpusDistribution()
562 Printf("%f ", Weights[i]); in UpdateCorpusDistribution()
566 Intervals.begin(), Intervals.end(), Weights.begin()); in UpdateCorpusDistribution()
571 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()
/freebsd/contrib/llvm-project/llvm/lib/Transforms/Scalar/
H A DLowerExpectIntrinsic.cpp97 SmallVector<uint32_t, 16> Weights(n + 1, UnlikelyBranchWeightVal); in handleSwitchExpect() local
100 Weights[Index] = LikelyBranchWeightVal; in handleSwitchExpect()
102 misexpect::checkExpectAnnotations(SI, Weights, /*IsFrontend=*/true); in handleSwitchExpect()
105 setBranchWeights(SI, Weights); in handleSwitchExpect()
H A DJumpThreading.cpp226 uint32_t Weights[2]; in updatePredecessorProfileMetadata() local
228 Weights[0] = BP.getNumerator(); in updatePredecessorProfileMetadata()
229 Weights[1] = BP.getCompl().getNumerator(); in updatePredecessorProfileMetadata()
231 Weights[0] = BP.getCompl().getNumerator(); in updatePredecessorProfileMetadata()
232 Weights[1] = BP.getNumerator(); in updatePredecessorProfileMetadata()
234 setBranchWeights(*PredBr, Weights); in updatePredecessorProfileMetadata()
2612 SmallVector<uint32_t, 4> Weights; in updateBlockFreqAndEdgeWeight() local
2614 Weights.push_back(Prob.getNumerator()); in updateBlockFreqAndEdgeWeight()
2617 setBranchWeights(*TI, Weights); in updateBlockFreqAndEdgeWeight()
H A DLoopPredication.cpp921 SmallVector<uint32_t> Weights; in isLoopProfitableToPredicate() local
922 extractBranchWeights(ProfileData, Weights); in isLoopProfitableToPredicate()
924 for (auto [i, Weight] : llvm::enumerate(Weights)) { in isLoopProfitableToPredicate()
H A DSimpleLoopUnswitch.cpp3022 SmallVector<uint32_t> Weights; in shouldTryInjectBasingOnMetadata() local
3023 if (!extractBranchWeights(*BI, Weights)) in shouldTryInjectBasingOnMetadata()
3028 assert(Weights.size() == 2 && "Unexpected profile data!"); in shouldTryInjectBasingOnMetadata()
3030 auto Num = Weights[Idx]; in shouldTryInjectBasingOnMetadata()
3031 auto Denom = Weights[0] + Weights[1]; in shouldTryInjectBasingOnMetadata()
/freebsd/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/
H A DPGOInstrumentation.cpp1424 SmallVector<uint32_t, 4> Weights; in populateCoverage() local
1426 Weights.push_back((Coverage[Succ] || !Coverage[&BB]) ? 1 : 0); in populateCoverage()
1427 if (Weights.size() >= 2) in populateCoverage()
1428 llvm::setBranchWeights(*BB.getTerminator(), Weights); in populateCoverage()
2195 SmallVector<unsigned, 4> Weights; in setProfMetadata() local
2197 Weights.push_back(scaleBranchCount(ECI, Scale)); in setProfMetadata()
2200 : Weights) { in setProfMetadata()
2204 misexpect::checkExpectAnnotations(*TI, Weights, /*IsFrontend=*/false); in setProfMetadata()
2206 setBranchWeights(*TI, Weights); in setProfMetadata()
2213 std::accumulate(Weights.begin(), Weights.end(), (uint64_t)0, in setProfMetadata()
[all …]
H A DControlHeightReduction.cpp1877 uint32_t Weights[] = { in fixupBranchesAndSelects() local
1881 setBranchWeights(*MergedBR, Weights); in fixupBranchesAndSelects()
1882 CHR_DEBUG(dbgs() << "CHR branch bias " << Weights[0] << ":" << Weights[1] in fixupBranchesAndSelects()
/freebsd/contrib/llvm-project/clang/lib/CodeGen/
H A DCodeGenPGO.cpp1338 CodeGenFunction::createProfileWeights(ArrayRef<uint64_t> Weights) const { in createProfileWeights()
1340 if (Weights.size() < 2) in createProfileWeights()
1344 uint64_t MaxWeight = *std::max_element(Weights.begin(), Weights.end()); in createProfileWeights()
1352 ScaledWeights.reserve(Weights.size()); in createProfileWeights()
1353 for (uint64_t W : Weights) in createProfileWeights()
H A DCGStmt.cpp933 llvm::MDNode *Weights = in EmitWhileStmt() local
935 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitWhileStmt()
1113 llvm::MDNode *Weights = in EmitForStmt() local
1115 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitForStmt()
1119 Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights); in EmitForStmt()
1198 llvm::MDNode *Weights = in EmitCXXForRangeStmt() local
1200 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitCXXForRangeStmt()
1203 Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights); in EmitCXXForRangeStmt()
1499 llvm::MDNode *Weights = nullptr; in EmitCaseStmtRange() local
1503 Weights = createProfileWeights(ThisCount, DefaultCount); in EmitCaseStmtRange()
[all …]
H A DCGDeclCXX.cpp411 llvm::MDNode *Weights; in EmitCXXGuardedInitBranch() local
417 Weights = nullptr; in EmitCXXGuardedInitBranch()
430 Weights = MDHelper.createBranchWeights(1, NumInits - 1); in EmitCXXGuardedInitBranch()
433 Builder.CreateCondBr(NeedsInit, InitBlock, NoInitBlock, Weights); in EmitCXXGuardedInitBranch()
/freebsd/contrib/llvm-project/llvm/lib/CodeGen/
H A DStackProtector.cpp671 MDNode *Weights = MDBuilder(F->getContext()) in InsertStackProtectors() local
676 /*Unreachable=*/false, Weights, DTU, in InsertStackProtectors()
H A DSafeStack.cpp472 MDNode *Weights = MDBuilder(F.getContext()) in checkStackGuard() local
476 SplitBlockAndInsertIfThen(Cmp, &RI, /* Unreachable */ true, Weights, DTU); in checkStackGuard()
/freebsd/contrib/llvm-project/llvm/lib/Transforms/IPO/
H A DSampleProfile.cpp1743 SmallVector<uint32_t, 4> Weights; in generateMDProfMetadata() local
1774 Weights.push_back(static_cast<uint32_t>(Weight + 1)); in generateMDProfMetadata()
1782 Weights.push_back(static_cast<uint32_t>(W)); in generateMDProfMetadata()
1792 misexpect::checkExpectAnnotations(*TI, Weights, /*IsFrontend=*/false); in generateMDProfMetadata()
1806 setBranchWeights(*TI, Weights); in generateMDProfMetadata()

12