Do not set branch weight if the branch weight annotation is present.
authorDehao Chen <dehao@google.com>
Thu, 23 Mar 2017 14:43:10 +0000 (14:43 +0000)
committerDehao Chen <dehao@google.com>
Thu, 23 Mar 2017 14:43:10 +0000 (14:43 +0000)
commit53a0c082d2f8e3dbd2e138adc7d0f60e46fed307
tree0a242cc149491f5bd66370e73835868cd2015f3e
parent50910bf842ca2d6bf16655ef3b74a8a34ca8c5f2
Do not set branch weight if the branch weight annotation is present.

Summary: ThinLTO will annotate the CFG twice. If the branch weight is set by the first annotation, we should not set the branch weight again in the second annotation because the first annotation is more accurate as there is less optimization that could affect debug info accuracy.

Reviewers: tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: mehdi_amini, aprantl, llvm-commits

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

llvm-svn: 298602
llvm/lib/Transforms/IPO/SampleProfile.cpp
llvm/test/Transforms/SampleProfile/branch.ll