[LLVMdev] Profile Based Branch Weight Metadata

Alastair Murray alastairmurray42 at gmail.com
Fri Aug 3 12:28:04 PDT 2012


Hi all,

Attached is a draft patch to use profiling data to set branch weight 
metadata.

I'm not formally submitting this as a patch yet as it does not make much 
sense to add it before ProfileInfo etc. is removed.  I am, however, 
interested in making sure this is the correct approach to be taking, or 
any other feedback.  (Also, there are a few TODO notes in there which 
would not be in the actual submission.)

It works with profiling data produced by -insert-edge-profiling (but not 
-insert-optimal-edge-profiling).  The loading of the data, the mapping 
of the data to the IR and the setting of metadata are each handled 
separately so changes to the profiling insertion code is not an issue. 
For example: -insert-edge-profiling inserts counters that have no 
relation to branch probabilities.

The patch was initially based on the ProfileInfoLoader code, though has 
been stripped down and rewritten quite significantly.  For review 
purposes it can be treated as new code.

The key function is probably setBranchWeightMetadata(...) near the end 
of the patch.

Regards,
Alastair.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: profile_branch_weight_metadata.patch
Type: text/x-patch
Size: 21582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120804/ae8f7c4c/attachment.bin>


More information about the llvm-dev mailing list