This is an archive of the discontinued LLVM Phabricator instance.

[llvm][NFC] Add comments and common-case API to MachineBlockFrequencyInfo
ClosedPublic

Authored by mtrofin on Jul 22 2020, 1:00 PM.

Details

Summary

Clarify the relation between a block's BlockFrequency and the
getEntryFreq() API, and added an API for the relatively common case of
finding a block's frequency relative to the entrypoint.

Added / moved some comments to header.

Diff Detail

Event Timeline

mtrofin created this revision.Jul 22 2020, 1:00 PM
hjyamauchi added inline comments.Jul 22 2020, 3:32 PM
llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
68

I'd go with "Entry" (or "EntryBlock") rather than "Entrypoint" here (and also in the new comments), as I don't think the latter is used around here.

Also, I'd use float instead of double and add parentheses around the division (so the "1.0 / ..." part
happens before the multiplication) to preserve the original spill cost formula below exactly. Slight errors might matter (might not but to be safe.)

mtrofin updated this revision to Diff 279961.Jul 22 2020, 3:46 PM
mtrofin marked 2 inline comments as done.

feedback

llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
68

Done - I suppose if a user wants to calculate double precision, they may still do so.

hjyamauchi accepted this revision.Jul 23 2020, 8:23 AM
This revision is now accepted and ready to land.Jul 23 2020, 8:23 AM
This revision was automatically updated to reflect the committed changes.