Tune basic block annotation algorithm.
authorDehao Chen <dehao@google.com>
Tue, 26 Apr 2016 04:59:11 +0000 (04:59 +0000)
committerDehao Chen <dehao@google.com>
Tue, 26 Apr 2016 04:59:11 +0000 (04:59 +0000)
commit5d6d4841eda8ec1eee5c170a920702e4a5d7bd71
tree01966914050c5b25eea140fb5ff786dd15d06c02
parentd6e92135bd5b419be68b16d8991953e2a8648785
Tune basic block annotation algorithm.

Summary:
Instead of using maximum IR weight as the basic block weight, this patch uses the voting algorithm to find the most likely weight for the basic block. This can effectively avoid the cases when some IRs are annotated incorrectly due to code motion of the profiled binary.

This patch also updates propagate.ll unittest to include discriminator in the input file so that it is testing something meaningful.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19301

llvm-svn: 267519
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/Inputs/propagate.prof
llvm/test/Transforms/SampleProfile/propagate.ll