@@ -46,25 +46,6 @@ cl::opt<unsigned> MinCallsiteColdBytePercent(
46
46
cl::desc(" Min percent of cold bytes at a callsite to discard non-cold "
47
47
" contexts" ));
48
48
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
-
68
49
MDNode *llvm::memprof::buildCallstackMetadata (ArrayRef<uint64_t > CallStack,
69
50
LLVMContext &Ctx) {
70
51
SmallVector<Metadata *, 8 > StackVals;
@@ -187,8 +168,7 @@ void CallStackTrie::addCallStack(MDNode *MIB) {
187
168
static MDNode *createMIBNode (LLVMContext &Ctx, ArrayRef<uint64_t > MIBCallStack,
188
169
AllocationType AllocType,
189
170
ArrayRef<ContextTotalSize> ContextSizeInfo,
190
- const uint64_t MaxColdSize, uint64_t &TotalBytes,
191
- uint64_t &ColdBytes) {
171
+ uint64_t &TotalBytes, uint64_t &ColdBytes) {
192
172
SmallVector<Metadata *> MIBPayload (
193
173
{buildCallstackMetadata (MIBCallStack, Ctx)});
194
174
MIBPayload.push_back (
@@ -204,21 +184,12 @@ static MDNode *createMIBNode(LLVMContext &Ctx, ArrayRef<uint64_t> MIBCallStack,
204
184
205
185
for (const auto &[FullStackId, TotalSize] : ContextSizeInfo) {
206
186
TotalBytes += TotalSize;
207
- bool LargeColdContext = false ;
208
- if (AllocType == AllocationType::Cold) {
187
+ if (AllocType == AllocationType::Cold)
209
188
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
- }
217
189
// 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 ) {
222
193
auto *FullStackIdMD = ValueAsMetadata::get (
223
194
ConstantInt::get (Type::getInt64Ty (Ctx), FullStackId));
224
195
auto *TotalSizeMD = ValueAsMetadata::get (
@@ -386,9 +357,9 @@ bool CallStackTrie::buildMIBNodes(CallStackTrieNode *Node, LLVMContext &Ctx,
386
357
if (hasSingleAllocType (Node->AllocTypes )) {
387
358
std::vector<ContextTotalSize> ContextSizeInfo;
388
359
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));
392
363
return true ;
393
364
}
394
365
@@ -442,8 +413,7 @@ bool CallStackTrie::buildMIBNodes(CallStackTrieNode *Node, LLVMContext &Ctx,
442
413
std::vector<ContextTotalSize> ContextSizeInfo;
443
414
collectContextSizeInfo (Node, ContextSizeInfo);
444
415
MIBNodes.push_back (createMIBNode (Ctx, MIBCallStack, AllocationType::NotCold,
445
- ContextSizeInfo, MaxColdSize, TotalBytes,
446
- ColdBytes));
416
+ ContextSizeInfo, TotalBytes, ColdBytes));
447
417
return true ;
448
418
}
449
419
0 commit comments