[llvm-commits] PATCH: Teach BranchProbabilityInfo to read branch metadata

Devang Patel dpatel at apple.com
Wed Oct 19 14:31:22 PDT 2011


On Oct 18, 2011, at 5:00 PM, Andrew Trick wrote:

> On Oct 18, 2011, at 4:12 PM, Eli Friedman wrote:
>>> As you're aware, the biggest problem with the branch weight metadata
>>> is CFG transforms invalidating it. You've already fixed the obvious
>>> swapSuccessors issue. That should at least make it usable, but we
>>> really have no way to verify this stuff currently.
>> 
>> Yes; Bob and I have discussed verification a bit.  It would really be
>> nice to have some confidence that passes that manipulate the CFG don't
>> accidentally mess up probablility/frequency information.
> 
> Someone could start with manually spot checking some cases where block frequency changes between passes.
> 
> To automate things a bit, some passes can be fixed to preserve BranchFrequenyInfo. BranchFrequencyInfo consistency can easily be automatically verified against BranchProbabilityInfo.
> 
> You can also keep around partial information and at least verify the regions that should be unaffected. For example, you can invalidate BlockFrequencyInfo for a given loop or interval, rerun frequency analysis and verify just the data points that are still valid.
> 
> On a tangent, BranchProbabilityInfo is in theory as easy to update as branch weight metadata. The choice between the two is really a matter of how we prefer other passes to interact/update the profile data.

One could also use a probe with pass manager's help (e.g. DebugInfoProbe) to pin point a pass that is invalidating (or droping) BranchFrequencyInfo (or branch weight metadata).

-
Devang



More information about the llvm-commits mailing list