This is an archive of the discontinued LLVM Phabricator instance.

[InstrProf] Emit warnings when correlating lightweight profiles
ClosedPublic

Authored by ellis on Jul 21 2023, 4:41 PM.

Details

Summary

Emit warnings when InstrProfCorrelator finds problems with debug info for lightweight instrumentation profile correlation. To prevent excessive printing, only emit the first 5 warnings.

In addition, remove a diagnostic about missing debug info in InstrProfiling.cpp. Some compiler-generated functions, e.g., __clang_call_terminate, does not emit debug info and will fail a build if -Werror is used. This warning is not actionable by the user and I have not seen non-compiler-generated functions fail this test.

Diff Detail

Event Timeline

ellis created this revision.Jul 21 2023, 4:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 4:41 PM
ellis published this revision for review.Jul 21 2023, 5:12 PM
ellis edited the summary of this revision. (Show Details)
ellis added reviewers: kyulee, phosek, wenlei.
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 5:13 PM
smeenai added a subscriber: smeenai.Aug 7 2023, 1:44 PM

Is it possible to add a test case?

phosek added inline comments.Aug 7 2023, 1:47 PM
llvm/lib/ProfileData/InstrProfCorrelator.cpp
267

Could this be controlled by an option, with default value being 5, rather than hardcoding the value here?

ellis updated this revision to Diff 548002.Aug 7 2023, 5:21 PM

Add flag ---max-debug-info-correlation-warnings and a test

Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2023, 5:21 PM
Herald added subscribers: Restricted Project, hoy, wlei. · View Herald Transcript
smeenai accepted this revision.Aug 15 2023, 2:44 PM

LGTM ... this seems like a straightforward enough improvement.

llvm/tools/llvm-profdata/llvm-profdata.cpp
3002 ↗(On Diff #548002)

For these sorts of flags, 0 usually means unlimited, and it might be good to follow that pattern here. E.g. see --error-limit in LLD (and I'm pretty sure Clang works the same way).

This revision is now accepted and ready to land.Aug 15 2023, 2:44 PM
ellis updated this revision to Diff 550502.Aug 15 2023, 3:15 PM

Use 0 to mean unlimited warnings

This revision was landed with ongoing or failed builds.Aug 15 2023, 3:28 PM
This revision was automatically updated to reflect the committed changes.