This is an archive of the discontinued LLVM Phabricator instance.

[CSSPGO][llvm-profgen] Fix getCanonicalFnName usage in llvm-profgen
ClosedPublic

Authored by wlei on Mar 8 2021, 5:50 PM.

Details

Summary

Previously we didn't support to keep the unique linkage name(-funique-internal-linkage-name) in llvm-profgen. As discussed in https://reviews.llvm.org/D96932, we choose to do canonicalization for it.

Now since "selected" is set as the default parameter of getCanonicalFnName in D96932, we don't need to add any attribute here for the previous usage and only fix the missing usage in the pseudo probe decoding.

Diff Detail

Event Timeline

wlei created this revision.Mar 8 2021, 5:50 PM
wlei requested review of this revision.Mar 8 2021, 5:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2021, 5:50 PM
wlei edited the summary of this revision. (Show Details)Mar 8 2021, 6:13 PM
wlei added reviewers: wmi, hoy, wenlei, davidxl.
wenlei added a comment.Mar 8 2021, 9:14 PM

Looks like this is the only place where canonicalization is missing. Would be good to have a test case for proper profile name canonicalization (removing other suffix, but not unique), otherwise looks good.

wlei added a comment.Mar 9 2021, 10:27 AM

Looks like this is the only place where canonicalization is missing. Would be good to have a test case for proper profile name canonicalization (removing other suffix, but not unique), otherwise looks good.

Yeah, two places for the dwarf-based name canonicalization: one in the symbolizer and another is for the call target name. for probe, only need to call getCanonicalFnName after func name decoding.

Good point to add test case, will add it later.

hoy added inline comments.Mar 9 2021, 11:00 AM
llvm/tools/llvm-profgen/PseudoProbe.cpp
165

Give it "selected" to avoid dropping .__unique suffix?

wlei added inline comments.Mar 9 2021, 12:14 PM
llvm/tools/llvm-profgen/PseudoProbe.cpp
165

The "selected" is already the default parameter, you can find it in https://reviews.llvm.org/D96932.

hoy added inline comments.Mar 9 2021, 12:46 PM
llvm/tools/llvm-profgen/PseudoProbe.cpp
165

Sounds good, thanks.

wlei updated this revision to Diff 330488.Mar 13 2021, 7:10 PM

Add test cases

wenlei accepted this revision.Mar 13 2021, 8:09 PM

lgtm, thanks.

This revision is now accepted and ready to land.Mar 13 2021, 8:09 PM
hoy accepted this revision.Mar 14 2021, 10:06 PM
wmi added inline comments.Mar 14 2021, 10:40 PM
llvm/test/tools/llvm-profgen/fname-canonicalization.test
2

Since the default strategy of getCanonicalFnName is "selected" which is trying to keep ".__uniq." suffix if it exists, so I guess the test will behave the same no matter whether getCanonicalFnName is functioning or not, is that correct? If that is the case, maybe add another type of "suffix" like '.llvm.' in the test?

wlei added inline comments.Mar 15 2021, 1:55 PM
llvm/test/tools/llvm-profgen/fname-canonicalization.test
2

Yes. Good point to add a test for other suffix.

Added the '.llvm.1000' suffix to the symbolizer test(provide a switch --show-canonical-fname for this). With the --show-canonical-fname, it will get rid of the '.llvm.1000' suffix.

wlei updated this revision to Diff 330798.Mar 15 2021, 1:55 PM

Addressing Wei's feedback

wmi accepted this revision.Mar 15 2021, 5:20 PM

LGTM. Thanks.

This revision was landed with ongoing or failed builds.Mar 15 2021, 9:01 PM
This revision was automatically updated to reflect the committed changes.