Skip to content

Commit 7db4ba3

Browse files
[GlobalMerge][NFC] Fix inaccurate comments (#124136)
I was studying the code here and realized that the comments were talking about grouping by basic blocks when the code was grouping by Function. Fix the comments so they reflect what the code is actually doing.
1 parent bca6dbd commit 7db4ba3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/CodeGen/GlobalMerge.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ bool GlobalMergeImpl::doMerge(SmallVectorImpl<GlobalVariable *> &Globals,
378378

379379
size_t UGSIdx = GlobalUsesByFunction[ParentFn];
380380

381-
// If this is the first global the basic block uses, map it to the set
381+
// If this is the first global the function uses, map it to the set
382382
// consisting of this global only.
383383
if (!UGSIdx) {
384384
// If that set doesn't exist yet, create it.
@@ -393,7 +393,8 @@ bool GlobalMergeImpl::doMerge(SmallVectorImpl<GlobalVariable *> &Globals,
393393
continue;
394394
}
395395

396-
// If we already encountered this BB, just increment the counter.
396+
// If we already encountered a use of this global in this function, just
397+
// increment the counter.
397398
if (UsedGlobalSets[UGSIdx].Globals.test(GI)) {
398399
++UsedGlobalSets[UGSIdx].UsageCount;
399400
continue;
@@ -423,7 +424,7 @@ bool GlobalMergeImpl::doMerge(SmallVectorImpl<GlobalVariable *> &Globals,
423424
}
424425

425426
// Now we found a bunch of sets of globals used together. We accumulated
426-
// the number of times we encountered the sets (i.e., the number of blocks
427+
// the number of times we encountered the sets (i.e., the number of functions
427428
// that use that exact set of globals).
428429
//
429430
// Multiply that by the size of the set to give us a crude profitability

0 commit comments

Comments
 (0)