Skip to content

Commit 0642bf9

Browse files
[ICP] Use a block with LLVM_DEBUG (NFC) (#140387)
Using a block inside LLVM_DEBUG allows us to simplify the code with a single LLVM_DEBUG and remove maybe_unused.
1 parent ac16520 commit 0642bf9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -858,13 +858,14 @@ bool IndirectCallPromoter::isProfitableToCompareVTables(
858858
auto &Candidate = Candidates[I];
859859
auto &VTableGUIDAndCounts = Candidate.VTableGUIDAndCounts;
860860

861-
LLVM_DEBUG(dbgs() << " Candidate " << I << " FunctionCount: "
862-
<< Candidate.Count << ", VTableCounts:");
863-
// Add [[maybe_unused]] since <GUID, Count> are only used by LLVM_DEBUG.
864-
for ([[maybe_unused]] auto &[GUID, Count] : VTableGUIDAndCounts)
865-
LLVM_DEBUG(dbgs() << " {" << Symtab->getGlobalVariable(GUID)->getName()
866-
<< ", " << Count << "}");
867-
LLVM_DEBUG(dbgs() << "\n");
861+
LLVM_DEBUG({
862+
dbgs() << " Candidate " << I << " FunctionCount: " << Candidate.Count
863+
<< ", VTableCounts:";
864+
for (const auto &[GUID, Count] : VTableGUIDAndCounts)
865+
dbgs() << " {" << Symtab->getGlobalVariable(GUID)->getName() << ", "
866+
<< Count << "}";
867+
dbgs() << "\n";
868+
});
868869

869870
uint64_t CandidateVTableCount = 0;
870871

0 commit comments

Comments
 (0)