Page MenuHomePhabricator

[CSSPGO] Deduplicating dangling pseudo probes.

Authored by hoy on Feb 25 2021, 9:06 AM.



Same dangling probes are redundant since they all have the same semantic that is to rely on the counts inference tool to get reasonable count for the same original block. Therefore, there's no need to keep multiple copies of them. I've seen jump threading created tons of redundant dangling probes that slowed down the compiler dramatically. Other optimization passes can also result in redundant probes though without an observed impact so far.

This change removes block-wise redundant dangling probes specifically introduced by jump threading. To support removing redundant dangling probes caused by all other passes, a final function-wise deduplication is also added.

An 18% size win of the .pseudo_probe section was seen for SPEC2017. No performance difference was observed.

Diff Detail

Event Timeline

hoy created this revision.Feb 25 2021, 9:06 AM
hoy requested review of this revision.Feb 25 2021, 9:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2021, 9:06 AM
wmi added inline comments.Feb 25 2021, 3:49 PM

If the interface can be changed to collectRedundantPseudoProbes(BasicBlock *Block, SmallVectorImpl<PseudoProbeInst *> &ToBeRemoved), it can be reused by the code above to remove redundent probes for the function.

hoy added inline comments.Feb 25 2021, 3:56 PM

Thanks for the suggestion. The code above actually handles MIR pseudo probe intrinsics while the code here handles IR intrinsics. I was thinking about sharing them but I feel templated code maybe needed and not sure about the worth of that complexity. What do you think?

wmi added inline comments.Feb 25 2021, 4:28 PM

Ah, ok. I didn't notice the difference. It needs some extra header file to include the template and share it with MIR pass. It may not worth it.


Do you need two tests one for IR pass and one for MIR pass?

hoy added inline comments.Feb 25 2021, 4:31 PM

Oh yeah, the IR test is actually included in D97481: [CSSPGO] Unblocking optimizations by dangling pseudo probes.. Let me move it here.

hoy updated this revision to Diff 326556.Feb 25 2021, 4:52 PM

Adding an IR test.

hoy updated this revision to Diff 326557.Feb 25 2021, 4:57 PM

Fixing existing test code to match exactly only one copy of probes deduplcated.

wmi accepted this revision.Feb 25 2021, 5:08 PM


This revision is now accepted and ready to land.Feb 25 2021, 5:08 PM
This revision was landed with ongoing or failed builds.Mar 3 2021, 10:45 PM
This revision was automatically updated to reflect the committed changes.