diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 8bc5671040f..f38eb5b3c06 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -224,8 +224,8 @@ static cl::opt<bool> EmitBranchProbability("pgo-emit-branch-prob", cl::init(false), cl::Hidden, cl::desc("When this option is on, the annotated " "branch probability will be emitted as " - " optimization remarks: -Rpass-analysis=" - "pgo-instr-use")); + "optimization remarks: -{Rpass|" + "pass-remarks}=pgo-instrumentation")); // Command line option to turn on CFG dot dump after profile annotation. // Defined in Analysis/BlockFrequencyInfo.cpp: -pgo-view-counts @@ -1595,13 +1595,15 @@ void llvm::setProfMetadata(Module *M, Instruction *TI, if (BrCondStr.empty()) return; - unsigned WSum = - std::accumulate(Weights.begin(), Weights.end(), 0, - [](unsigned w1, unsigned w2) { return w1 + w2; }); + uint64_t WSum = + std::accumulate(Weights.begin(), Weights.end(), (uint64_t)0, + [](uint64_t w1, uint64_t w2) { return w1 + w2; }); uint64_t TotalCount = - std::accumulate(EdgeCounts.begin(), EdgeCounts.end(), 0, + std::accumulate(EdgeCounts.begin(), EdgeCounts.end(), (uint64_t)0, [](uint64_t c1, uint64_t c2) { return c1 + c2; }); - BranchProbability BP(Weights[0], WSum); + Scale = calculateCountScale(WSum); + BranchProbability BP(scaleBranchCount(Weights[0], Scale), + scaleBranchCount(WSum, Scale)); std::string BranchProbStr; raw_string_ostream OS(BranchProbStr); OS << BP; |

