[PATCH] D65303: [BPI] Adjust the probability for floating point unordered comparison

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 08:28:23 PDT 2019


Carrot added inline comments.


================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:122
+/// This is the probability for an ordered floating point comparison.
+static const uint32_t FPH_ORD_WEIGHT = 1024 * 1024 - 1;
+/// This is the probability for an unordered floating point comparison, it means
----------------
scanon wrote:
> How was this weight selected? Why 2**20 - 1 in particular? If it's just to match IH_TAKEN_WEIGHT, let's use that value instead of repeating it here.
> 
> The comment could probable use a little work, too. I broadly agree with the *effect* of this change, but I don't think that unordered is that rare--rather, NaN is often an indication that something has gone wrong, and it makes sense to move that off the hot path.
It has no semantic relation with IH_TAKEN_WEIGHT, I looked for an appropriate weight to represent the extremely likely probability, and IH_TAKEN_WEIGHT has the similar effect on control flow, so I used the same number.

Do you still think it's better to use IH_TAKEN_WEIGHT here, or what probability is more appropriate here?


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

https://reviews.llvm.org/D65303





More information about the llvm-commits mailing list