[PATCH] D12603: Use fixed-point representation for BranchProbability

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 11:57:39 PDT 2015


davidxl added inline comments.

================
Comment at: lib/Support/BranchProbability.cpp:98
@@ -59,3 +97,3 @@
   Rem = ((Rem % D) << 32) | Lower32;
-  uint64_t LowerQ = Rem / D;
+  uint64_t LowerQ = (Rem + D / 2) / D;
   uint64_t Q = (UpperQ << 32) + LowerQ;
----------------
Should D/2 be added to ProductLow above (and check overflow and carry bit)?

Besides, independent on what scale factor to use for BP,  I think this change should not be included in this patch. It changes the rounding behavior of the scale() method (instead of truncating) which is irrelevant to the main purpose of the patch. This should be done as a follow up patch if it is desirable.


http://reviews.llvm.org/D12603





More information about the llvm-commits mailing list