Page MenuHomePhabricator

[SampleFDO] Fix a crash when the sample profile uses md5 and -sample-profile-merge-inlinee is enabled

Authored by wmi on Jul 30 2020, 5:56 PM.



When -sample-profile-merge-inlinee is enabled, new FunctionSamples may be created during profile merge without GUIDToFuncNameMap being initialized. That will occasionally cause compiler crash. The patch fixes it.

Diff Detail

Event Timeline

wmi created this revision.Jul 30 2020, 5:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 5:56 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
wmi requested review of this revision.Jul 30 2020, 5:56 PM
davidxl accepted this revision.Jul 30 2020, 7:43 PM



nit: name it UpdateFunctionSamples

This revision is now accepted and ready to land.Jul 30 2020, 7:43 PM
wenlei added a subscriber: hoyFB.Jul 30 2020, 8:21 PM

Just realized this is fixing the same issue as @hoyFB's D84997 - we ran into it immediately after -sample-profile-merge-inlinee is turned on too.

It looks to me that we only need to transfer GUIDToFuncNameMap during merge as the map is shared, so it can be done at merge time like D84997. What do you think? That's the fixed we used internally.

wmi added a comment.Jul 30 2020, 8:26 PM

Yes, the fix in D84997 is more concise. Here I use a straightforward fix. It is ok for Hongtao to commit D84997, but just add a testcase (free to use the one here).

wmi added a comment.Jul 30 2020, 9:27 PM

Commit the fix for the second problem in D84997 together with the assertion and testcase in this patch, so D84997 can be dedicated to solve the other problem.