[SamplePGO] Add switch to honor zero count on block level as accurate
authorWenlei He <aktoon@gmail.com>
Tue, 21 Sep 2021 00:35:36 +0000 (17:35 -0700)
committerWenlei He <aktoon@gmail.com>
Wed, 22 Sep 2021 00:06:37 +0000 (17:06 -0700)
commit5f187f0afaad33013ba03454c4749d99b1362534
tree5450c13b0b91e17c4427037c9eb0cc294c33fbc6
parentf8b1cc36578608f2f840d7ea8b0aa9b28fdaa492
[SamplePGO] Add switch to honor zero count on block level as accurate

Add a new LLVM switch `-profile-sample-block-accurate` to trust zero block counts for branches. Currently we leave out such zero counts when annotating branch weight metadata, which would lead to weights being considered as unknown.

Differential Revision: https://reviews.llvm.org/D110117
llvm/lib/Transforms/IPO/SampleProfile.cpp