[PATCH] D50591: [PGO] Control Height Reduction

Richard Trieu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 21:32:11 PDT 2018


rtrieu 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());
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D50591





More information about the llvm-commits mailing list