Skip to content

Commit

Permalink
[GlobalMerge][NFC] Fix inaccurate comments (#124136)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelmaitland authored Jan 23, 2025
1 parent bca6dbd commit 7db4ba3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions llvm/lib/CodeGen/GlobalMerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ bool GlobalMergeImpl::doMerge(SmallVectorImpl<GlobalVariable *> &Globals,

size_t UGSIdx = GlobalUsesByFunction[ParentFn];

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

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

// Now we found a bunch of sets of globals used together. We accumulated
// the number of times we encountered the sets (i.e., the number of blocks
// the number of times we encountered the sets (i.e., the number of functions
// that use that exact set of globals).
//
// Multiply that by the size of the set to give us a crude profitability
Expand Down

0 comments on commit 7db4ba3

Please sign in to comment.