[PATCH] D50591: [PGO] Control Height Reduction

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 5 08:42:53 PDT 2018


yamauchi added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Instrumentation/ControlHeightReduction.cpp:610-616
+  APInt TrueWt = TrueWeight->getValue();
+  APInt FalseWt = FalseWeight->getValue();
+  APInt SumWt = TrueWt + FalseWt;
+  TrueProb = BranchProbability::getBranchProbability(TrueWt.getZExtValue(),
+                                                     SumWt.getZExtValue());
+  FalseProb = BranchProbability::getBranchProbability(FalseWt.getZExtValue(),
+                                                      SumWt.getZExtValue());
----------------
rtrieu wrote:
> This calculation is in danger of overflowing when the weights are large.  I made a fix in r341444 to calculate the sum weight in 64 bits to prevent the overflow.
Thanks for the fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D50591





More information about the llvm-commits mailing list