This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO] Fix missing debug info of dangling pseudo probe
ClosedPublic

Authored by wlei on Apr 23 2021, 1:01 PM.

Details

Summary

While doing speculative execution opt, it conservatively drops all insn's debug info in the merged ThenBB(see the loop at line 2384) including the dangling probe. The missing debug info of the dangling probe will cause the wrong inference computation.

So we should avoid dropping the debug info from pseudo probe, this change try to fix this by moving the to-be dangling probe to the merging target BB before the debug info is dropped.

Diff Detail

Event Timeline

wlei created this revision.Apr 23 2021, 1:01 PM
wlei requested review of this revision.Apr 23 2021, 1:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 23 2021, 1:01 PM
wlei edited the summary of this revision. (Show Details)Apr 23 2021, 1:10 PM
wlei added reviewers: hoy, wenlei, wmi, davidxl.
wenlei added inline comments.Apr 23 2021, 1:28 PM
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2386

can we assert we are not dropping dbg metadata for any probes?

wlei updated this revision to Diff 340155.Apr 23 2021, 1:42 PM

addressing Wenlei's feedback

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2386

Good point, assertion added.

wenlei added inline comments.Apr 23 2021, 1:45 PM
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2386

assert("..") will not fire, i guess you meant something like llvm_unreachable here?. Though I think the convention is like this:

assert(!isa<PseudoProbeInst>(I) && "Should not drop debug info from any pseudo probes.");
wlei updated this revision to Diff 340159.Apr 23 2021, 1:52 PM

fix assertion condition

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
2386

Oops, just tried this way but made a naive mistake...

hoy added inline comments.Apr 23 2021, 2:00 PM
llvm/test/Transforms/SampleProfile/pseudo-probe-dangle2.ll
185

Thanks for making the test. Can you move the checks to near beginning of the file and add a check for the function entry proceeding the probe? Otherwise lgtm.

186

Nit: [[#]] is a shortcut for matching decimal numbers.

wlei updated this revision to Diff 340163.Apr 23 2021, 2:14 PM

address Hongtao's feedback: refine the test case

hoy accepted this revision.Apr 23 2021, 2:15 PM

lgtm, thx!

This revision is now accepted and ready to land.Apr 23 2021, 2:15 PM
wenlei accepted this revision.Apr 23 2021, 2:23 PM

lgtm

This revision was landed with ongoing or failed builds.Apr 23 2021, 2:29 PM
This revision was automatically updated to reflect the committed changes.
Harbormaster completed remote builds in B100666: Diff 340159.