This is an archive of the discontinued LLVM Phabricator instance.

[SampleFDO] Fix a bug when appending function symbol into the Callees set of Root node in ProfiledCallGraph.
ClosedPublic

Authored by wmi on May 3 2021, 11:15 PM.

Details

Summary

In ProfiledCallGraph::addProfiledFunction, to add a function symbol into the ProfiledCallGraph, currently an uninitialized ProfiledCallGraphNode node is created and inserted into Callees set of Root node before the node is initialized. The Callees set use ProfiledCallGraphNodeComparer as its comparator so the uninitialized ProfiledCallGraphNode may fail to be inserted into Callees set if the uninitialized memory may happen to contain a name which has been inserted into the Callees set before. The problem will prevent some function symbols from being annotated with profiles and cause performance regression. The patch fixes the problem.

Diff Detail

Event Timeline

wmi requested review of this revision.May 3 2021, 11:15 PM
wmi created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 3 2021, 11:15 PM
wenlei accepted this revision.May 3 2021, 11:18 PM

good catch, thanks for the fix!

This revision is now accepted and ready to land.May 3 2021, 11:18 PM
hoy accepted this revision.May 3 2021, 11:32 PM

LGTM, thanks!