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

Andrew Trick atrick at apple.com
Tue Oct 18 18:09:33 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.

I forgot to mention that the ultimate verification would be to output expected branch probabilities of the optimized code, instrument branches, and compare the data produced by profiling the optimized binary on the same workload used as profile input.

-Andy



More information about the llvm-commits mailing list