This is an archive of the discontinued LLVM Phabricator instance.

[PseudoProbe] Do not emit pseudo probes when module is not probed.
ClosedPublic

Authored by hoy on Mar 15 2022, 1:41 PM.

Details

Summary

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.

Diff Detail

Event Timeline

hoy created this revision.Mar 15 2022, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 1:41 PM
hoy requested review of this revision.Mar 15 2022, 1:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 1:41 PM
hoy added a reviewer: wenlei.Mar 15 2022, 1:42 PM

It is possible to let users know when this happens? Ideally it's something user need to fix - pass flags consistently.

hoy updated this revision to Diff 418020.Mar 24 2022, 12:28 PM

Warn user of non-probed importing modules.

hoy edited the summary of this revision. (Show Details)Mar 24 2022, 12:29 PM
wenlei added inline comments.Mar 24 2022, 10:03 PM
llvm/lib/Linker/IRMover.cpp
1238–1242

Suggest rephrase the warning message with something like: Pseudo-probe ignored: source module (<module name>) is compiled with -fpseudo-probe-for-profiling while destination module (<module name>) is not.

hoy added inline comments.Mar 25 2022, 12:45 PM
llvm/lib/Linker/IRMover.cpp
1238–1242

Sounds good.

hoy updated this revision to Diff 418302.Mar 25 2022, 12:46 PM
hoy edited the summary of this revision. (Show Details)

Updating D121737: [PseudoProbe] Do not emit pseudo probes when module is not probed.

wenlei accepted this revision.Mar 25 2022, 12:46 PM

lgtm, thanks.

This revision is now accepted and ready to land.Mar 25 2022, 12:46 PM
This revision was landed with ongoing or failed builds.Mar 25 2022, 1:00 PM
This revision was automatically updated to reflect the committed changes.