@@ -46,25 +46,6 @@ cl::opt<unsigned> MinCallsiteColdBytePercent(
4646 cl::desc(" Min percent of cold bytes at a callsite to discard non-cold "
4747 " contexts" ));
4848
49- // Enable saving context size information for largest cold contexts, which can
50- // be used to flag contexts for more aggressive cloning and reporting.
51- cl::opt<unsigned > MinPercentMaxColdSize (
52- " memprof-min-percent-max-cold-size" , cl::init(100 ), cl::Hidden,
53- cl::desc(" Min percent of max cold bytes for critical cold context" ));
54-
55- bool llvm::memprof::metadataIncludesAllContextSizeInfo () {
56- return MemProfReportHintedSizes || MinClonedColdBytePercent < 100 ;
57- }
58-
59- bool llvm::memprof::metadataMayIncludeContextSizeInfo () {
60- return metadataIncludesAllContextSizeInfo () || MinPercentMaxColdSize < 100 ;
61- }
62-
63- bool llvm::memprof::recordContextSizeInfoForAnalysis () {
64- return metadataMayIncludeContextSizeInfo () ||
65- MinCallsiteColdBytePercent < 100 ;
66- }
67-
6849MDNode *llvm::memprof::buildCallstackMetadata (ArrayRef<uint64_t > CallStack,
6950 LLVMContext &Ctx) {
7051 SmallVector<Metadata *, 8 > StackVals;
@@ -187,8 +168,7 @@ void CallStackTrie::addCallStack(MDNode *MIB) {
187168static MDNode *createMIBNode (LLVMContext &Ctx, ArrayRef<uint64_t > MIBCallStack,
188169 AllocationType AllocType,
189170 ArrayRef<ContextTotalSize> ContextSizeInfo,
190- const uint64_t MaxColdSize, uint64_t &TotalBytes,
191- uint64_t &ColdBytes) {
171+ uint64_t &TotalBytes, uint64_t &ColdBytes) {
192172 SmallVector<Metadata *> MIBPayload (
193173 {buildCallstackMetadata (MIBCallStack, Ctx)});
194174 MIBPayload.push_back (
@@ -204,21 +184,12 @@ static MDNode *createMIBNode(LLVMContext &Ctx, ArrayRef<uint64_t> MIBCallStack,
204184
205185 for (const auto &[FullStackId, TotalSize] : ContextSizeInfo) {
206186 TotalBytes += TotalSize;
207- bool LargeColdContext = false ;
208- if (AllocType == AllocationType::Cold) {
187+ if (AllocType == AllocationType::Cold)
209188 ColdBytes += TotalSize;
210- // If we have the max cold context size from summary information and have
211- // requested identification of contexts above a percentage of the max, see
212- // if this context qualifies.
213- if (MaxColdSize > 0 && MinPercentMaxColdSize < 100 &&
214- TotalSize * 100 >= MaxColdSize * MinPercentMaxColdSize)
215- LargeColdContext = true ;
216- }
217189 // Only add the context size info as metadata if we need it in the thin
218- // link (currently if reporting of hinted sizes is enabled, we have
219- // specified a threshold for marking allocations cold after cloning, or we
220- // have identified this as a large cold context of interest above).
221- if (metadataIncludesAllContextSizeInfo () || LargeColdContext) {
190+ // link (currently if reporting of hinted sizes is enabled or we have
191+ // specified a threshold for marking allocations cold after cloning).
192+ if (MemProfReportHintedSizes || MinClonedColdBytePercent < 100 ) {
222193 auto *FullStackIdMD = ValueAsMetadata::get (
223194 ConstantInt::get (Type::getInt64Ty (Ctx), FullStackId));
224195 auto *TotalSizeMD = ValueAsMetadata::get (
@@ -386,9 +357,9 @@ bool CallStackTrie::buildMIBNodes(CallStackTrieNode *Node, LLVMContext &Ctx,
386357 if (hasSingleAllocType (Node->AllocTypes )) {
387358 std::vector<ContextTotalSize> ContextSizeInfo;
388359 collectContextSizeInfo (Node, ContextSizeInfo);
389- MIBNodes.push_back (
390- createMIBNode (Ctx, MIBCallStack, (AllocationType)Node->AllocTypes ,
391- ContextSizeInfo, MaxColdSize , TotalBytes, ColdBytes));
360+ MIBNodes.push_back (createMIBNode (Ctx, MIBCallStack,
361+ (AllocationType)Node->AllocTypes ,
362+ ContextSizeInfo , TotalBytes, ColdBytes));
392363 return true ;
393364 }
394365
@@ -442,8 +413,7 @@ bool CallStackTrie::buildMIBNodes(CallStackTrieNode *Node, LLVMContext &Ctx,
442413 std::vector<ContextTotalSize> ContextSizeInfo;
443414 collectContextSizeInfo (Node, ContextSizeInfo);
444415 MIBNodes.push_back (createMIBNode (Ctx, MIBCallStack, AllocationType::NotCold,
445- ContextSizeInfo, MaxColdSize, TotalBytes,
446- ColdBytes));
416+ ContextSizeInfo, TotalBytes, ColdBytes));
447417 return true ;
448418}
449419
0 commit comments