Lines Matching +full:non +full:- +full:overlap +full:- +full:time

1 //===- InstrProf.cpp - Instrumented profiling format support --------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
63 "static-func-full-module-prefix", cl::init(true), cl::Hidden,
67 // This option is tailored to users that have different top-level directory in
68 // profile-gen and profile-use compilation. Users need to specific the number
72 // Note current ThinLTO module importing for the indirect-calls assumes
73 // the source directory name not being stripped. A non-zero option value here
74 // can potentially prevent some inter-module indirect-call-promotions.
76 "static-func-strip-dirname-prefix", cl::init(0), cl::Hidden,
221 "enable-name-compression",
225 "enable-vtable-value-profiling", cl::init(false),
228 "call promotion to do selective vtable-based comparison."));
231 "enable-vtable-profile-use", cl::init(false),
294 --Count; in stripDirPrefix()
303 StringRef FileName(GO.getParent()->getSourceFileName()); in getStrippedSourceFileName()
304 uint32_t StripLevel = StaticFuncFullModulePrefix ? 0 : (uint32_t)-1; in getStrippedSourceFileName()
312 // The PGO name has the format [<filepath>;]<mangled-name> where <filepath>; is
315 // <filepath> or <mangled-name>.
318 // [<filepath>:]<mangled-name>. This caused trouble for Objective-C functions
330 StringRef S = cast<MDString>(MD->getOperand(0))->getString(); in lookupPGONameFromMetadata()
348 // data, its original linkage must be non-internal.
373 // for front-end (Clang, etc) instrumentation.
396 // PGONameMetadata should be set by compiler at profile use time in getPGOName()
431 const char InvalidChars[] = "-:;<>/\"'"; in getPGOFuncNameVarName()
457 new GlobalVariable(M, Value->getType(), true, Linkage, Value, in createPGOFuncNameVar()
461 if (!GlobalValue::isLocalLinkage(FuncNameVar->getLinkage())) in createPGOFuncNameVar()
462 FuncNameVar->setVisibility(GlobalValue::HiddenVisibility); in createPGOFuncNameVar()
499 auto NameToGUIDMap = [&](StringRef Name) -> Error { in addVTableWithName()
521 /// sub-strings. The substrings are separated by 0 or more zero bytes. This
619 auto NameToGUIDMap = [&](StringRef Name) -> Error { in addFuncWithName()
650 if (It != AddrToMD5Map.end() && It->first == Address) in getFunctionHashFromAddress()
651 return (uint64_t)It->second; in getFunctionHashFromAddress()
671 .count(getInstrProfNameSeparator()) == (NameStrs.size() - 1) && in collectGlobalObjectNameStrings()
681 unsigned HeaderLen = P - &Header[0]; in collectGlobalObjectNameStrings()
701 auto *Arr = cast<ConstantDataArray>(NameVar->getInitializer()); in getPGOFuncNameVarInitializer()
703 Arr->isCString() ? Arr->getAsCString() : Arr->getAsString(); in getPGOFuncNameVarInitializer()
745 void InstrProfValueSiteRecord::overlap(InstrProfValueSiteRecord &Input, in overlap() function in llvm::InstrProfValueSiteRecord
747 OverlapStats &Overlap, in overlap() argument
749 this->sortByTargetValues(); in overlap()
757 if (I->Value == J->Value) { in overlap()
758 Score += OverlapStats::score(I->Count, J->Count, in overlap()
759 Overlap.Base.ValueCounts[ValueKind], in overlap()
760 Overlap.Test.ValueCounts[ValueKind]); in overlap()
762 I->Count, J->Count, FuncLevelOverlap.Base.ValueCounts[ValueKind], in overlap()
765 } else if (I->Value < J->Value) { in overlap()
771 Overlap.Overlap.ValueCounts[ValueKind] += Score; in overlap()
772 FuncLevelOverlap.Overlap.ValueCounts[ValueKind] += FuncLevelScore; in overlap()
778 OverlapStats &Overlap, in overlapValueProfData() argument
790 ThisSiteRecords[I].overlap(OtherSiteRecords[I], ValueKind, Overlap, in overlapValueProfData()
794 void InstrProfRecord::overlap(InstrProfRecord &Other, OverlapStats &Overlap, in overlap() function in llvm::InstrProfRecord
814 Overlap.addOneMismatch(FuncLevelOverlap.Test); in overlap()
818 // Compute overlap for value counts. in overlap()
820 overlapValueProfData(Kind, Other, Overlap, FuncLevelOverlap); in overlap()
824 // Compute overlap for edge counts. in overlap()
827 Overlap.Base.CountSum, Overlap.Test.CountSum); in overlap()
830 Overlap.Overlap.CountSum += Score; in overlap()
831 Overlap.Overlap.NumEntries += 1; in overlap()
839 FuncLevelOverlap.Overlap.CountSum = FuncScore; in overlap()
840 FuncLevelOverlap.Overlap.NumEntries = Other.Counts.size(); in overlap()
848 this->sortByTargetValues(); in merge()
855 while (I != IE && I->Value < J.Value) { in merge()
859 if (I != IE && I->Value == J.Value) { in merge()
861 I->Count = SaturatingMultiplyAdd(J.Count, Weight, I->Count, &Overflowed); in merge()
971 for (auto &Count : this->Counts) { in scale()
992 return SymTab->getFunctionHashFromAddress(Value); in remapValue()
995 return SymTab->getVTableHashFromAddress(Value); in remapValue()
1037 It->getSecond() = std::min<size_t>(It->getSecond(), Timestamp); in createBPFunctionNodes()
1084 return reinterpret_cast<const InstrProfRecord *>(Record)->getNumValueKinds(); in getNumValueKindsInstrProf()
1089 ->getNumValueSites(VKind); in getNumValueSitesInstrProf()
1094 ->getNumValueData(VKind); in getNumValueDataInstrProf()
1100 return IPR->getValueArrayForSite(VK, S).size(); in getNumValueDataForSiteInstrProf()
1106 llvm::copy(IPR->getValueArrayForSite(K, S), Dst); in getValueForSiteInstrProf()
1149 uint8_t ValueDataCount = this->SiteCountArray[VSite]; in deserializeTo()
1158 // is the on-disk source endianness, and New is the host endianness.
1190 VR->deserializeTo(Record, SymTab); in deserializeTo()
1210 for (uint32_t K = 0; K < this->NumValueKinds; K++) { in checkIntegrity()
1211 if (VR->Kind > IPVK_Last) in checkIntegrity()
1215 if ((char *)VR - (char *)this > (ptrdiff_t)TotalSize) in checkIntegrity()
1241 VPD->swapBytesToHost(Endianness); in getValueProfData()
1243 Error E = VPD->checkIntegrity(); in getValueProfData()
1261 VR->swapBytes(Endianness, llvm::endianness::native); in swapBytesToHost()
1275 VR->swapBytes(llvm::endianness::native, Endianness); in swapBytesFromHost()
1320 if (--MDCount == 0) in annotateValueSite()
1332 if (MD->getNumOperands() < 5) in mayHaveValueProfileOfKind()
1335 MDString *Tag = cast<MDString>(MD->getOperand(0)); in mayHaveValueProfileOfKind()
1336 if (!Tag || Tag->getString() != "VP") in mayHaveValueProfileOfKind()
1340 ConstantInt *KindInt = mdconst::dyn_extract<ConstantInt>(MD->getOperand(1)); in mayHaveValueProfileOfKind()
1343 if (KindInt->getZExtValue() != ValueKind) in mayHaveValueProfileOfKind()
1359 const unsigned NOps = MD->getNumOperands(); in getValueProfDataFromInst()
1361 ConstantInt *TotalCInt = mdconst::dyn_extract<ConstantInt>(MD->getOperand(2)); in getValueProfDataFromInst()
1364 TotalC = TotalCInt->getZExtValue(); in getValueProfDataFromInst()
1366 ValueData.reserve((NOps - 3) / 2); in getValueProfDataFromInst()
1370 ConstantInt *Value = mdconst::dyn_extract<ConstantInt>(MD->getOperand(I)); in getValueProfDataFromInst()
1372 mdconst::dyn_extract<ConstantInt>(MD->getOperand(I + 1)); in getValueProfDataFromInst()
1377 uint64_t CntValue = Count->getZExtValue(); in getValueProfDataFromInst()
1381 V.Value = Value->getZExtValue(); in getValueProfDataFromInst()
1428 // worse, since the referenced counter from profile per-function data object in needsComdatForCounter()
1444 M->getNamedGlobal(INSTR_PROF_QUOTE(INSTR_PROF_RAW_VERSION_VAR)); in isIRPGOFlagSet()
1445 if (!IRInstrVar || IRInstrVar->hasLocalLinkage()) in isIRPGOFlagSet()
1448 // For CSPGO+LTO, this variable might be marked as non-prevailing and we only in isIRPGOFlagSet()
1450 if (IRInstrVar->isDeclaration()) in isIRPGOFlagSet()
1454 if (!IRInstrVar->hasInitializer()) in isIRPGOFlagSet()
1457 auto *InitVal = dyn_cast_or_null<ConstantInt>(IRInstrVar->getInitializer()); in isIRPGOFlagSet()
1460 return (InitVal->getZExtValue() & VARIANT_MASK_IR_PROF) != 0; in isIRPGOFlagSet()
1469 // Unsafe to rename the address-taken function (which can be used in in canRenameComdatFunc()
1493 M, ProfileNameConst->getType(), true, GlobalValue::WeakAnyLinkage, in createProfileFileNameVar()
1495 ProfileNameVar->setVisibility(GlobalValue::HiddenVisibility); in createProfileFileNameVar()
1498 ProfileNameVar->setLinkage(GlobalValue::ExternalLinkage); in createProfileFileNameVar()
1499 ProfileNameVar->setComdat(M.getOrInsertComdat( in createProfileFileNameVar()
1508 CountSumOrPercent &Sum) -> Error { in accumulateCounts()
1509 // This function is only used from llvm-profdata that doesn't use any kind in accumulateCounts()
1517 Reader->accumulateCounts(Sum, IsCS); in accumulateCounts()
1526 this->BaseFilename = &BaseFilename; in accumulateCounts()
1527 this->TestFilename = &TestFilename; in accumulateCounts()
1535 for (unsigned I = 0; I < IPVK_Last - IPVK_First + 1; I++) { in addOneMismatch()
1545 for (unsigned I = 0; I < IPVK_Last - IPVK_First + 1; I++) { in addOneUnique()
1558 OS << "Profile overlap infomation for base_profile: " << *BaseFilename in dump()
1565 OS << " # of " << EntryName << " overlap: " << Overlap.NumEntries << "\n"; in dump()
1573 OS << " Edge profile overlap: " << format("%.3f%%", Overlap.CountSum * 100) in dump()
1586 for (unsigned I = 0; I < IPVK_Last - IPVK_First + 1; I++) { in dump()
1605 << " profile overlap: " << format("%.3f%%", Overlap.ValueCounts[I] * 100) in dump()