This is an archive of the discontinued LLVM Phabricator instance.

[AutoFDO] Fix handling of empty profiles
ClosedPublic

Authored by david2050 on Aug 2 2016, 12:58 PM.

Details

Summary

If a profile has no samples for a function, then the function "entry count" is set to the value 0. Several places in the code test that if the Function::getEntryCount is defined at all. Here we change to treat a 0 entry count the same as undefined.

In particular, this fixes a problem in getLayoutSuccessorProbThreshold in MachineBlockPlacement.cpp where we use a different and inferior heuristic for laying out basic blocks.

Diff Detail

Repository
rL LLVM

Event Timeline

david2050 updated this revision to Diff 66531.Aug 2 2016, 12:58 PM
david2050 retitled this revision from to [AutoFDO] Fix handling of empty profiles.
david2050 updated this object.
david2050 added a reviewer: dnovillo.
david2050 added a subscriber: llvm-commits.
david2050 updated this revision to Diff 66542.Aug 2 2016, 1:26 PM

fix formatting

dnovillo edited edge metadata.

Adding Dehao. ISTR something special about 0 counts in profiles, but I don't recall details. Dehao, this looks fine to me, but will it break anything for samplepgo?

danielcdh edited edge metadata.Aug 5 2016, 9:54 AM

LGTM

I will have another patch to set entry count to be at least 1 if there is sample for the function.

Thanks, would one of you please accept?

danielcdh accepted this revision.Aug 5 2016, 10:07 AM
danielcdh edited edge metadata.

Adding Dehao. ISTR something special about 0 counts in profiles, but I don't recall details. Dehao, this looks fine to me, but will it break anything for samplepgo?

This revision is now accepted and ready to land.Aug 5 2016, 10:07 AM
dnovillo accepted this revision.Aug 5 2016, 10:07 AM
dnovillo edited edge metadata.
This revision was automatically updated to reflect the committed changes.