Skip to content

Commit 762ab4f

Browse files
committed
IRGen: Add a counter for GOT entries emitted
1 parent 054d7b9 commit 762ab4f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

include/swift/Basic/Statistics.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ FRONTEND_STATISTIC(SILModule, NumSILOptWitnessTables)
286286
FRONTEND_STATISTIC(SILModule, NumSILOptDefaultWitnessTables)
287287
FRONTEND_STATISTIC(SILModule, NumSILOptGlobalVariables)
288288

289-
/// The next 9 statistics count kinds of LLVM entities produced
289+
/// The next 10 statistics count kinds of LLVM entities produced
290290
/// during the IRGen phase: globals, functions, aliases, ifuncs,
291291
/// named metadata, value and comdat symbols, basic blocks,
292-
/// and instructions.
292+
/// instructions, and GOT entries.
293293
FRONTEND_STATISTIC(IRModule, NumIRGlobals)
294294
FRONTEND_STATISTIC(IRModule, NumIRFunctions)
295295
FRONTEND_STATISTIC(IRModule, NumIRAliases)
@@ -299,6 +299,7 @@ FRONTEND_STATISTIC(IRModule, NumIRValueSymbols)
299299
FRONTEND_STATISTIC(IRModule, NumIRComdatSymbols)
300300
FRONTEND_STATISTIC(IRModule, NumIRBasicBlocks)
301301
FRONTEND_STATISTIC(IRModule, NumIRInsts)
302+
FRONTEND_STATISTIC(IRModule, NumGOTEntries)
302303

303304
/// Number of bytes written to the object-file output stream
304305
/// of the frontend job, which should be the same as the size of

lib/IRGen/GenDecl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,6 +2695,9 @@ llvm::Constant *IRGenModule::getOrCreateGOTEquivalent(llvm::Constant *global,
26952695
return gotEntry;
26962696
}
26972697

2698+
if (Context.Stats)
2699+
Context.Stats->getFrontendCounters().NumGOTEntries++;
2700+
26982701
// Use the global as the initializer for an anonymous constant. LLVM can treat
26992702
// this as equivalent to the global's GOT entry.
27002703
auto gotEquivalent = createGOTEquivalent(*this, global, entity);

0 commit comments

Comments
 (0)