[PATCH] D35804: [BPI] Detect branches in loops that make themselves not taken

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 14:12:16 PST 2018


davidxl added a comment.

The branch probability depends on other factors which is not considered here.

For instance

1. the value of MAX. In the example, if MAX is 1, then the branch probablity should be 50%
2. the step /increment of n

More generally, the predicted probability should depend on MAX/step. The larger the value, the less likely the branch is taken.



================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:463
+static void
+computeUnlikelySuccessors(const BasicBlock *BB, Loop *L,
+                          SmallPtrSetImpl<const BasicBlock*> &UnlikelyBlocks) {
----------------
Add some documentation on the function documenting the parameters.


Repository:
  rL LLVM

https://reviews.llvm.org/D35804





More information about the llvm-commits mailing list