Home
last modified time | relevance | path

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

12

/llvm-project-15.0.7/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.cpp401 SmallVector<uint32_t, 2> Weights; in calcMetadataWeights() local
404 Weights.reserve(TI->getNumSuccessors()); in calcMetadataWeights()
412 Weights.push_back(Weight->getZExtValue()); in calcMetadataWeights()
413 WeightSum += Weights.back(); in calcMetadataWeights()
423 assert(Weights.size() == TI->getNumSuccessors() && "Checked above"); in calcMetadataWeights()
433 Weights[I] /= ScalingFactor; in calcMetadataWeights()
434 WeightSum += Weights[I]; in calcMetadataWeights()
442 Weights[I] = 1; in calcMetadataWeights()
449 BP.push_back({ Weights[I], static_cast<uint32_t>(WeightSum) }); in calcMetadataWeights()
683 SmallVector<uint32_t, 4> Weights; in getMaxEstimatedEdgeWeight() local
/llvm-project-15.0.7/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()
/llvm-project-15.0.7/llvm/lib/Transforms/Utils/
H A DMisExpect.cpp138 SmallVector<uint32_t, 4> Weights(NOps - 1); in extractWeights() local
143 Weights[Idx - 1] = V; in extractWeights()
146 return Weights; in extractWeights()
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.cpp219 SmallVector<uint32_t, 8> Weights; in ConstantFoldTerminator() local
223 Weights.push_back(CI->getValue().getZExtValue()); in ConstantFoldTerminator()
227 Weights[0] += Weights[idx+1]; in ConstantFoldTerminator()
229 std::swap(Weights[idx+1], Weights.back()); in ConstantFoldTerminator()
230 Weights.pop_back(); in ConstantFoldTerminator()
233 createBranchWeights(Weights)); in ConstantFoldTerminator()
/llvm-project-15.0.7/llvm/lib/Transforms/Scalar/
H A DLowerExpectIntrinsic.cpp98 SmallVector<uint32_t, 16> Weights(n + 1, UnlikelyBranchWeightVal); in handleSwitchExpect() local
101 Weights[Index] = LikelyBranchWeightVal; in handleSwitchExpect()
103 misexpect::checkExpectAnnotations(SI, Weights, /*IsFrontend=*/true); in handleSwitchExpect()
108 MDBuilder(CI->getContext()).createBranchWeights(Weights)); in handleSwitchExpect()
H A DJumpThreading.cpp290 SmallVector<uint32_t, 2> Weights; in updatePredecessorProfileMetadata() local
292 Weights.push_back(BP.getNumerator()); in updatePredecessorProfileMetadata()
293 Weights.push_back(BP.getCompl().getNumerator()); in updatePredecessorProfileMetadata()
295 Weights.push_back(BP.getCompl().getNumerator()); in updatePredecessorProfileMetadata()
296 Weights.push_back(BP.getNumerator()); in updatePredecessorProfileMetadata()
300 .createBranchWeights(Weights)); in updatePredecessorProfileMetadata()
2573 SmallVector<uint32_t, 4> Weights; in updateBlockFreqAndEdgeWeight() local
2575 Weights.push_back(Prob.getNumerator()); in updateBlockFreqAndEdgeWeight()
2580 MDBuilder(TI->getParent()->getContext()).createBranchWeights(Weights)); in updateBlockFreqAndEdgeWeight()
/llvm-project-15.0.7/llvm/lib/IR/
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.cpp4423 if (!Weights) in buildProfBranchWeightsMD()
4453 this->Weights = std::move(Weights); in init()
4458 if (Weights) { in removeCase()
4465 Weights.value()[I->getCaseIndex() + 1] = Weights.value().back(); in removeCase()
4480 } else if (Weights) { in addCase()
4484 if (Weights) in addCase()
4493 if (Weights) in eraseFromParent()
4494 Weights->resize(0); in eraseFromParent()
4500 if (!Weights) in getSuccessorWeight()
4510 if (!Weights && *W) in setSuccessorWeight()
[all …]
/llvm-project-15.0.7/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()
/llvm-project-15.0.7/clang/lib/CodeGen/
H A DCodeGenPGO.cpp1090 CodeGenFunction::createProfileWeights(ArrayRef<uint64_t> Weights) const { in createProfileWeights()
1092 if (Weights.size() < 2) in createProfileWeights()
1096 uint64_t MaxWeight = *std::max_element(Weights.begin(), Weights.end()); in createProfileWeights()
1104 ScaledWeights.reserve(Weights.size()); in createProfileWeights()
1105 for (uint64_t W : Weights) in createProfileWeights()
H A DCGStmt.cpp903 llvm::MDNode *Weights = in EmitWhileStmt() local
905 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitWhileStmt()
1083 llvm::MDNode *Weights = in EmitForStmt() local
1085 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitForStmt()
1089 Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights); in EmitForStmt()
1168 llvm::MDNode *Weights = in EmitCXXForRangeStmt() local
1170 if (!Weights && CGM.getCodeGenOpts().OptimizationLevel) in EmitCXXForRangeStmt()
1173 Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights); in EmitCXXForRangeStmt()
1470 llvm::MDNode *Weights = nullptr; in EmitCaseStmtRange() local
1474 Weights = createProfileWeights(ThisCount, DefaultCount); in EmitCaseStmtRange()
[all …]
H A DCGDeclCXX.cpp401 llvm::MDNode *Weights; in EmitCXXGuardedInitBranch() local
407 Weights = nullptr; in EmitCXXGuardedInitBranch()
420 Weights = MDHelper.createBranchWeights(1, NumInits - 1); in EmitCXXGuardedInitBranch()
423 Builder.CreateCondBr(NeedsInit, InitBlock, NoInitBlock, Weights); in EmitCXXGuardedInitBranch()
H A DCodeGenFunction.cpp1863 llvm::MDNode *Weights = nullptr; in EmitBranchOnBoolExpr() local
1886 Weights = createProfileWeights(TrueCount, CurrentCount - TrueCount); in EmitBranchOnBoolExpr()
1889 Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights, Unpredictable); in EmitBranchOnBoolExpr()
/llvm-project-15.0.7/llvm/unittests/Analysis/
H A DProfileSummaryInfoTest.cpp342 SmallVector<uint32_t, 1> Weights; in TEST_F() local
343 Weights.push_back(1000); in TEST_F()
345 CI2->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in TEST_F()
/llvm-project-15.0.7/llvm/lib/Transforms/Instrumentation/
H A DPGOInstrumentation.cpp1969 SmallVector<unsigned, 4> Weights; in setProfMetadata() local
1971 Weights.push_back(scaleBranchCount(ECI, Scale)); in setProfMetadata()
1974 : Weights) { in setProfMetadata()
1978 misexpect::checkExpectAnnotations(*TI, Weights, /*IsFrontend=*/false); in setProfMetadata()
1980 TI->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in setProfMetadata()
1987 std::accumulate(Weights.begin(), Weights.end(), (uint64_t)0, in setProfMetadata()
1993 BranchProbability BP(scaleBranchCount(Weights[0], Scale), in setProfMetadata()
H A DControlHeightReduction.cpp1842 uint32_t Weights[] = { in fixupBranchesAndSelects() local
1847 MergedBR->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in fixupBranchesAndSelects()
1848 CHR_DEBUG(dbgs() << "CHR branch bias " << Weights[0] << ":" << Weights[1] in fixupBranchesAndSelects()
/llvm-project-15.0.7/llvm/include/llvm/IR/
H A DMDBuilder.h64 MDNode *createBranchWeights(ArrayRef<uint32_t> Weights);
/llvm-project-15.0.7/llvm/lib/CodeGen/
H A DStackProtector.cpp558 MDNode *Weights = MDBuilder(F->getContext()) in InsertStackProtectors() local
561 B.CreateCondBr(Cmp, NewBB, FailBB, Weights); in InsertStackProtectors()
H A DSafeStack.cpp472 MDNode *Weights = MDBuilder(F.getContext()) in checkStackGuard() local
476 SplitBlockAndInsertIfThen(Cmp, &RI, /* Unreachable */ true, Weights, DTU); in checkStackGuard()
/llvm-project-15.0.7/llvm/lib/Transforms/IPO/
H A DSampleProfile.cpp1658 SmallVector<uint32_t, 4> Weights; in generateMDProfMetadata() local
1689 Weights.push_back(static_cast<uint32_t>(Weight + 1)); in generateMDProfMetadata()
1697 Weights.push_back(static_cast<uint32_t>(W)); in generateMDProfMetadata()
1724 TI->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); in generateMDProfMetadata()
/llvm-project-15.0.7/llvm/docs/
H A DBlockFrequencyTerminology.rst26 Weights are relative to the other edges of a given predecessor block. The
/llvm-project-15.0.7/llvm/unittests/IR/
H A DIRBuilderTest.cpp467 MDNode *Weights = MDBuilder(Ctx).createBranchWeights(42, 13); in TEST_F() local
468 BI = Builder.CreateCondBr(Builder.getTrue(), TBB, FBB, Weights); in TEST_F()
474 EXPECT_EQ(Weights, TI->getMetadata(LLVMContext::MD_prof)); in TEST_F()

12