[llvm] c24e5f9 - [GlobalMerge] Fix inaccurate debug print. (#124377)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 12:45:43 PST 2025
Author: Craig Topper
Date: 2025-01-27T12:45:41-08:00
New Revision: c24e5f982e2791768aeea8b1fb55e951f80aad75
URL: https://github.com/llvm/llvm-project/commit/c24e5f982e2791768aeea8b1fb55e951f80aad75
DIFF: https://github.com/llvm/llvm-project/commit/c24e5f982e2791768aeea8b1fb55e951f80aad75.diff
LOG: [GlobalMerge] Fix inaccurate debug print. (#124377)
This message was not updated when MinSize was added.
Added:
Modified:
llvm/lib/CodeGen/GlobalMerge.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index 7b1aa7c30e581a..5993fc939a08a1 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -728,7 +728,8 @@ bool GlobalMergeImpl::run(Module &M) {
Type *Ty = GV.getValueType();
TypeSize AllocSize = DL.getTypeAllocSize(Ty);
- if (AllocSize < Opt.MaxOffset && AllocSize >= Opt.MinSize) {
+ bool CanMerge = AllocSize < Opt.MaxOffset && AllocSize >= Opt.MinSize;
+ if (CanMerge) {
if (TM &&
TargetLoweringObjectFile::getKindForGlobal(&GV, *TM).isBSS())
BSSGlobals[{AddressSpace, Section}].push_back(&GV);
@@ -737,11 +738,8 @@ bool GlobalMergeImpl::run(Module &M) {
else
Globals[{AddressSpace, Section}].push_back(&GV);
}
- LLVM_DEBUG(dbgs() << "GV "
- << ((DL.getTypeAllocSize(Ty) < Opt.MaxOffset)
- ? "to merge: "
- : "not to merge: ")
- << GV << "\n");
+ LLVM_DEBUG(dbgs() << "GV " << (CanMerge ? "" : "not ") << "to merge: " << GV
+ << "\n");
}
for (auto &P : Globals)
More information about the llvm-commits
mailing list