This is an archive of the discontinued LLVM Phabricator instance.

Add optional profile counts to block frequency dump.
ClosedPublic

Authored by hjyamauchi on Sep 13 2017, 4:30 PM.

Details

Summary

Print profile counts as the third value in addition to the existing 'float' and
the 'int' values in the textual block frequency dump, if available.

Event Timeline

hjyamauchi created this revision.Sep 13 2017, 4:30 PM
davidxl added inline comments.Sep 13 2017, 4:34 PM
include/llvm/Analysis/BlockFrequencyInfoImpl.h
1286

can you just pass *F instead of *F->getFunction() ?

hjyamauchi added inline comments.Sep 13 2017, 4:44 PM
include/llvm/Analysis/BlockFrequencyInfoImpl.h
1286

It requires Function* and F can be either Function* or MachineFunction*. MachineFunction isn't a subtype of Function. Do you see otherwise? I tried several ways to handle this issue with templates, but they didn't seem to work mainly because MachineFunction isn't fully defined in this header file and this is a template function that can't be moved to a .cpp file.

davidxl edited edge metadata.Sep 13 2017, 4:48 PM

Perhaps provide a simple overload getBlockProfileCount for MachineFunction?

davidxl accepted this revision.Sep 13 2017, 5:03 PM

lgtm

This revision is now accepted and ready to land.Sep 13 2017, 5:03 PM

The last note is that, as I suspect, we don't include a header in CodeGen/ into a file under Analysis/ which prevents the overload idea from working.

hjyamauchi closed this revision.Sep 13 2017, 5:21 PM