Skip to content

Commit c24e5f9

Browse files
authored
[GlobalMerge] Fix inaccurate debug print. (#124377)
This message was not updated when MinSize was added.
1 parent 0cbb1d5 commit c24e5f9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/CodeGen/GlobalMerge.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ bool GlobalMergeImpl::run(Module &M) {
728728

729729
Type *Ty = GV.getValueType();
730730
TypeSize AllocSize = DL.getTypeAllocSize(Ty);
731-
if (AllocSize < Opt.MaxOffset && AllocSize >= Opt.MinSize) {
731+
bool CanMerge = AllocSize < Opt.MaxOffset && AllocSize >= Opt.MinSize;
732+
if (CanMerge) {
732733
if (TM &&
733734
TargetLoweringObjectFile::getKindForGlobal(&GV, *TM).isBSS())
734735
BSSGlobals[{AddressSpace, Section}].push_back(&GV);
@@ -737,11 +738,8 @@ bool GlobalMergeImpl::run(Module &M) {
737738
else
738739
Globals[{AddressSpace, Section}].push_back(&GV);
739740
}
740-
LLVM_DEBUG(dbgs() << "GV "
741-
<< ((DL.getTypeAllocSize(Ty) < Opt.MaxOffset)
742-
? "to merge: "
743-
: "not to merge: ")
744-
<< GV << "\n");
741+
LLVM_DEBUG(dbgs() << "GV " << (CanMerge ? "" : "not ") << "to merge: " << GV
742+
<< "\n");
745743
}
746744

747745
for (auto &P : Globals)

0 commit comments

Comments
 (0)