Grigory Pastukhov 97faac1a71
[CSSPGO] Preserve pseudo-probe discriminators in cloneWithBaseDiscriminator (#178267)
In the O0 pipeline, `SampleProfileProbePass` runs before
`AddDiscriminatorsPass`. The
pseudo-probe pass stores probe IDs in the discriminator field using a
special encoding
(bits [2:0] = 0x7 as marker). When `AddDiscriminatorsPass` later
processes instructions
on the same source line, it calls `cloneWithBaseDiscriminator()` which
overwrites these
pseudo-probe discriminators with DWARF base discriminators, breaking
sample profile
matching.

This patch adds a check to `cloneWithBaseDiscriminator()` to detect and
preserve
pseudo-probe discriminators, similar to the existing check in 
`cloneByMultiplyingDuplicationFactor()`.

In optimized pipelines (O1+), AddDiscriminators runs before pseudo-probe
instrumentation,
so this issue doesn't manifest. However, the fix makes the code robust
regardless of
pass ordering.
2026-01-28 10:24:56 -08:00
..