[PseudoProbe] Do not emit pseudo probes when module is not probed.
authorHongtao Yu <hoy@fb.com>
Thu, 24 Mar 2022 18:15:34 +0000 (11:15 -0700)
committerHongtao Yu <hoy@fb.com>
Fri, 25 Mar 2022 19:59:53 +0000 (12:59 -0700)
commite25f4e4c4a6df1d9f84e9506d2391fb0019bc941
tree6bac671c963a2ea837962bbf7207df16ebad688b
parent0e1e3ccc989af2ac274bc46e05e7f4c06b3f5e46
[PseudoProbe] Do not emit pseudo probes when module is not probed.

There is a case when a function has pseudo probe intrinsics but the module it resides does not have the probe desc. This could happen when the current module is not built with `-fpseudo-probe-for-profiling` while a function in it calls some other function from a probed module. In thinLTO mode, the callee function could be imported and inlined into the current function.
While this is undefined behavior, I'm fixing the asm printer to not ICE and warn user about this.

Reviewed By: wenlei

Differential Revision: https://reviews.llvm.org/D121737
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/Linker/IRMover.cpp
llvm/test/ThinLTO/X86/pseudo-probe-desc-import.ll