[PATCH] D159322: LoopVectorize: Set branch_weight for conditional branches

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 13:53:23 PDT 2023


MatzeB added a comment.

> like when emitMemRuntimeChecks is done, we really just don't know how likely these arrays overlap or not.



> Is the plan to fill in something that's somewhat reasonable first which is basically a best effort guess, and then later fine tune that? This case is different from the general likely/unlikely weights, which is more straightforward.

I don't know either how likely these cases are. And in the end it will depend heavily on the programming patterns and style of the source code. The weights may be right for one program while the next program might repeat a pattern where the weights are wrong.

However I am convinced that the current weights are better than the default 50:50 assumption that we would get for not setting any weights so it's good to set them. I don't really have data on how good/bad the choice here is and we should definitely keep tuning this (or ideally find ways to get FDO feedback, even though admittedly I don't know how FDO/PGO feedback would work as that seems a tricky problem when mapping backwards, but it's something I at least want to start thinking deeper about :) )


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159322/new/

https://reviews.llvm.org/D159322



More information about the llvm-commits mailing list