Skip to content

Commit cf2d5ae

Browse files
committed
[GlobalMerge] Fix inaccurate debug print.
This message was not updated when MinSize was added.
1 parent db1ee18 commit cf2d5ae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/CodeGen/GlobalMerge.cpp

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

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

0 commit comments

Comments
 (0)