Commit b7cd564
authored
[IR] Don't verify module flags on every access (#102153)
8b4306c introduced validity checks for every module flag access,
because the auto-upgrader uses named metadata before verifying the
module.
This causes overhead for all other accesses, and the check is, in fact,
only need at that single place. Change the upgrader to be careful when
accessing module flags before the module is verified and remove the
checks on all other occasions.
There are two tangential optimizations included: first, when querying a
specific flag, don't enumerate all other flags into a vector as well.
Second, don't use a Twine for getNamedMetadata(), which has
materialization overhead -- all call sites use simple strings that can
be implicitly converted to a StringRef.1 parent 1d2b6d9 commit b7cd564
File tree
3 files changed
+35
-42
lines changed- llvm
- include/llvm/IR
- lib/IR
3 files changed
+35
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | 161 | | |
167 | 162 | | |
168 | 163 | | |
| |||
502 | 497 | | |
503 | 498 | | |
504 | 499 | | |
505 | | - | |
| 500 | + | |
506 | 501 | | |
507 | 502 | | |
508 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4886 | 4886 | | |
4887 | 4887 | | |
4888 | 4888 | | |
4889 | | - | |
| 4889 | + | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
| 4893 | + | |
| 4894 | + | |
| 4895 | + | |
| 4896 | + | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
4890 | 4908 | | |
4891 | 4909 | | |
4892 | 4910 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
| 262 | + | |
| 263 | + | |
266 | 264 | | |
267 | 265 | | |
268 | 266 | | |
| |||
296 | 294 | | |
297 | 295 | | |
298 | 296 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | 297 | | |
314 | 298 | | |
315 | 299 | | |
316 | 300 | | |
317 | 301 | | |
318 | 302 | | |
319 | 303 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
328 | 310 | | |
329 | 311 | | |
330 | 312 | | |
331 | 313 | | |
332 | 314 | | |
333 | 315 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
339 | 322 | | |
340 | 323 | | |
341 | 324 | | |
| |||
388 | 371 | | |
389 | 372 | | |
390 | 373 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 374 | + | |
395 | 375 | | |
396 | 376 | | |
397 | 377 | | |
| |||
0 commit comments