[PGO] Fix select instruction annotation
authorRong Xu <xur@google.com>
Tue, 25 Oct 2016 21:47:24 +0000 (21:47 +0000)
committerRong Xu <xur@google.com>
Tue, 25 Oct 2016 21:47:24 +0000 (21:47 +0000)
commit33308f92ebef0a0848997f912659c50ddf647383
tree142670fd3c0522f394dd02b2a21fce001a94a85f
parentfa2412b2e706d18c1afb7f70f34353baebb9c0ba
[PGO] Fix select instruction annotation

Summary:
Select instruction annotation in IR PGO uses the edge count to infer the
branch count. It's currently placed in setInstrumentedCounts() where
no all the BB counts have been computed. This leads to wrong branch weights.
Move the annotation after all BB counts are populated.

Reviewers: davidxl

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25961

llvm-svn: 285128
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/test/Transforms/PGOProfile/Inputs/select2.proftext [new file with mode: 0644]
llvm/test/Transforms/PGOProfile/select2.ll [new file with mode: 0644]