This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Don't set the function hotness attribute when populating counters
ClosedPublic

Authored by xur on Mar 26 2016, 8:21 AM.

Details

Summary

Don't set the function hotness attribute on the fly. This changes the CFG branch probability of the caller function, which leads to inconsistent BB ordering. This patch moves the attribute setting to a separated loop after the counts in all functions are populated.

Fixes PR27024 - PGO instrumentation profile data is not reflected in correct basic blocks.

Diff Detail

Repository
rL LLVM

Event Timeline

xur updated this revision to Diff 51715.Mar 26 2016, 8:21 AM
xur retitled this revision from to [PGO] Don't set the function hotness attribute when populating counters.
xur updated this object.
xur added a reviewer: davidxl.
xur added subscribers: llvm-commits, xur.
davidxl edited edge metadata.Mar 26 2016, 9:39 AM

The logic to set InlineHint should be removed and handled by inline cost analysis (FE based pgo removed it already) -- but that is a separate patch.

lib/Transforms/Instrumentation/PGOInstrumentation.cpp
463 ↗(On Diff #51715)

Initialize FreqAttr to Normal

481 ↗(On Diff #51715)

FFA_Normal,
FFA_Cold,
FFA_Hot

519 ↗(On Diff #51715)

Move this closer to other private data members.

xur updated this revision to Diff 51722.Mar 26 2016, 3:29 PM
xur edited edge metadata.
xur marked 3 inline comments as done.

Integrated David's review comments.

Thanks,

-Rong

davidxl accepted this revision.Mar 28 2016, 9:46 AM
davidxl edited edge metadata.

lgtm

This revision is now accepted and ready to land.Mar 28 2016, 9:46 AM
This revision was automatically updated to reflect the committed changes.