11 Commits

Author SHA1 Message Date
Alan Zhao
a1062d98bb
[profcheck] Print the function name in the error (#177264)
This is helpful for tests with a lot of test cases and grepping for
instructions with missing profile data isn't feasible because it doesn't
account for things like vectors which are exempt.

Tracking issue: #147390
2026-01-22 10:09:52 -08:00
Mircea Trofin
4b42944732
[profcheck] Don't verify generated global ctors/dtors (#170597)
Functions listed in `llvm.global_ctors` or `llvm.global_dtors` aren't too interesting for performance. Passes like LowerTypeTests synthesize some of these, and, while we could add a "0" entry count explicitly, we can also just not bother verifying in the first place.
2025-12-04 13:01:46 -08:00
Mircea Trofin
b9d98110e1
[profcheck] Exclude naked, asm-only functions from profcheck (#168447)
We can't do anything meaningful to such functions: they aren't optimizable, and even if inlined, they would bring no code open to optimization.
2025-11-20 08:32:57 -08:00
Aiden Grossman
4c4ffd30cd
[ProfCheck] Refactor Select Instrumentation to use Early Exits (#168086)
I think this is quite a bit more readable than the nested conditionals.
From review feedback that was not addressed precommitn in #167973.
2025-11-14 15:25:40 -08:00
Mircea Trofin
815453f841
[profcheck] Disable verification of selects on vector conditions. (#167973)
We don't currently support profile metadata on selects where the condition is a vector.

Issue #147390
2025-11-13 20:35:34 -08:00
Mircea Trofin
792a7bbd99
[profcheck] Option to inject distinct small weights (#159644)
There are cases where the easiest way to regression-test a profile change is to add `!prof`​ metadata, with small numbers as to simplify manual verification. To ensure coverage, this (the inserting) may become tedious. This patch makes `prof-inject`​ do that for us, if so opted in.

The list of weights used is a bunch of primes,  used as a circular buffer.

Issue #147390
2025-09-24 11:40:36 -07:00
Mircea Trofin
2a99532b89
[profcheck] Allow unknown function entry count (#155918)
Some passes synthesize functions, e.g. WPD, so we may need to indicate “this synthesized function’s entry count cannot be estimated at compile time” - akin to `branch_weights`​.

Issue #147390
2025-09-04 13:15:23 -07:00
Kazu Hirata
cbf5af9668
[llvm] Remove unused includes (NFC) (#154051)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-08-17 23:46:35 -07:00
Mircea Trofin
f675483905
[profcheck] Annotate select instructions (#152171)
For `select`, we don't have the equivalent of the branch probability analysis to offer defaults, so we make up our own and allow their overriding with flags.

Issue #147390
2025-08-06 02:48:50 +02:00
Mircea Trofin
9a60841dc4
[PGO][profcheck] ignore explicitly cold functions (#151778)
There is a case when branch profile metadata is OK to miss, namely, cold functions. The goal of the RFC (see the referenced issue) is to avoid accidental omission (and, at a later date, corruption) of profile metadata. However, asking cold functions to have all their conditional branches marked with "0" probabilities would be overdoing it. We can just ask cold functions to have an explicit 0 entry count.

This patch:
- injects an entry count for functions, unless they have one (synthetic or not)
- if the entry count is 0, doesn't inject, nor does it verify the rest of the metadata
- at verification, if the entry count is missing, it reports an error

Issue #147390
2025-08-04 03:53:49 +02:00
Mircea Trofin
df2d2d125b
[PGO] Add ProfileInjector and ProfileVerifier passes (#147388)
Adding 2 passes, one to inject `MD_prof` and one to check its presence. A subsequent patch will add these (similar to debugify) to `opt` (and, eventually, a variant of this, to `llc`)

Tracking issue: #147390
2025-07-23 21:34:58 +02:00