This is an archive of the discontinued LLVM Phabricator instance.

Add an optional arg to include/exclude synthetic profile when query hasProfileData
ClosedPublic

Authored by davidxl on Apr 23 2019, 9:09 AM.

Details

Summary

The arg is defaulted to false as most of the users of the interface checks for branch probability data.

Synthetic profile propagation is not on by default, so this patch has no effect on default compilations.

Diff Detail

Event Timeline

davidxl created this revision.Apr 23 2019, 9:09 AM
eraman accepted this revision.Apr 23 2019, 11:35 AM
eraman added inline comments.
include/llvm/IR/Function.h
310

To me
return EC.hasValue() && (IncludeSynthetic || !EC.isSynthetic()) looks cleaner and readable, but I'll leave it to you.

This revision is now accepted and ready to land.Apr 23 2019, 11:35 AM
davidxl updated this revision to Diff 196348.Apr 23 2019, 3:55 PM

Updated the patch to include more APIs.

Instead of passing a boolean, would it be better to pass ProfileCountType enum? Right now it doesn't make a difference as there are only two valid profile count types, but if that set expands, we could make them like bitmasks and then get a subset match.

It is tempting to use enum in this case, however I don't see possible extension to the type (in forseable future), so perhaps keep this way.

eraman accepted this revision.Apr 23 2019, 5:20 PM
davidxl updated this revision to Diff 196385.Apr 23 2019, 11:20 PM

Update related interfaces in ProfileSummaryInfo.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2019, 12:49 PM