[PATCH] D17353: Set minimum cost of speculating an instruction.

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 11:04:44 PST 2016


Branch probability info needs to be used here for guidance if possible:
1) highly biased branch should be marked as predictable and skipped
2) the cost of speculation needs to be weighted using probability info.

Regarding the iterative nature of the SampleFDO, I think the right
approach is for the second iteration build to force ifcvt if the first
iteration does it (and leading to missing branch prob data in the
second iteration).

David

On Thu, Feb 18, 2016 at 10:50 AM, Dehao Chen <danielcdh at gmail.com> wrote:
> danielcdh added a comment.
>
> The lower_bound case is quite interesting. If the input value is close to first or last, which means branch prediction within the loop will be mostly correct, the non-if-converted version is 2X faster than if-converted version. If the the input value is completely randomly distributed, the if-converted version is 2X faster than non-if-converted version.
>
> So overall, it's hard to make the decision without looking at the branch misprediction rate for the specific branch.
>
>
> http://reviews.llvm.org/D17353
>
>
>


More information about the llvm-commits mailing list