@@ -54,7 +54,8 @@ The following statistics can be recorded:
54
54
55
55
* For SILFunctions: the number of SIL basic blocks for each SILFunction, the
56
56
number of SIL instructions, the number of SILInstructions of a specific
57
- kind (e.g. a number of alloc_ref instructions)
57
+ kind (e.g. a number of alloc_ref instructions), the number of debug
58
+ variables
58
59
59
60
* For SILModules: the number of SIL basic blocks in the SILModule, the number
60
61
of SIL instructions, the number of SILFunctions, the number of
@@ -118,6 +119,16 @@ e.g. `-Xllvm -sil-stats-only-instructions=alloc_ref,alloc_stack`. If you need to
118
119
collect stats about all kinds of SIL instructions, you can use this syntax:
119
120
` -Xllvm -sil-stats-only-instructions=all ` .
120
121
122
+ ### Debug variable level counters
123
+ A different type of counter is the lost debug variables counter. It is enabled
124
+ by using the ` -Xllvm -sil-stats-lost-variables ` command-line option. It only
125
+ tracks statistics about lost variables in SILFunctions. It is not enabled by
126
+ any other command-line option, but can be combined with the others. It is not
127
+ compatible with thresholds, it always counts lost variables. Note that it does
128
+ not track the number of debug variables: it counts the number of debug variables
129
+ that were present, but aren't anymore. If a variable changes location or scope,
130
+ which is not allowed, it will be counted as lost.
131
+
121
132
## Configuring which counters changes should be recorded
122
133
123
134
The user has a possibility to configure a number of thresholds, which control
@@ -181,9 +192,9 @@ And for counter stats it looks like this:
181
192
* ` function_history ` corresponds to the verbose mode of function
182
193
counters collection, when changes to the SILFunction counters are logged
183
194
unconditionally, without any on-line filtering.
184
- * ` CounterName ` is typically one of ` block ` , ` inst ` , ` function ` , ` memory ` ,
185
- or ` inst_instruction_name ` if you collect counters for specific kinds of SIL
186
- instructions.
195
+ * ` CounterName ` is typically one of ` block ` , ` inst ` , ` function ` , ` memory ` ,
196
+ ` lostvars ` , or ` inst_instruction_name ` if you collect counters for specific
197
+ kinds of SIL instructions.
187
198
* ` Symbol ` is e.g. the name of a function
188
199
* ` StageName ` is the name of the current optimizer pipeline stage
189
200
* ` TransformName ` is the name of the current optimizer transformation/pass
@@ -192,6 +203,14 @@ And for counter stats it looks like this:
192
203
want to reproduce the result later using
193
204
` -Xllvm -sil-opt-pass-count -Xllvm TransformPassNumber `
194
205
206
+ ## Extract Lost Variables per Pass
207
+
208
+ For lost variables, there is a script to output a CSV with only the amount of
209
+ lost variables per pass. You can then easily open the resulting CSV in Numbers
210
+ to make graphs.
211
+
212
+ ` utils/process-stats-lost-variables csv_file_with_counters > csv_aggregate `
213
+
195
214
## Storing the produced statistics into a database
196
215
197
216
To store the set of produced counters into a database, you can use the
@@ -345,4 +364,3 @@ from Counters C where C.counter = 'inst' and C.kind = 'module'
345
364
group by Stage
346
365
order by sum (C .Delta );
347
366
```
348
-
0 commit comments