From 3fac6498e1540100c0d597d3662287e38e5826ff Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Mon, 13 Jan 2014 21:24:25 +0000 Subject: CodeGen: Clarify a comment about PGO in case statement ranges llvm-svn: 199140 --- clang/lib/CodeGen/CGStmt.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CGStmt.cpp') diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 79db4184868..880e801189a 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -999,9 +999,10 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S) { // Range is small enough to add multiple switch instruction cases. uint64_t Total = CaseCnt.getCount() - CaseCnt.getParentCount(); unsigned NCases = Range.getZExtValue() + 1; - // Divide the weights evenly between the cases, ensuring that the total - // weight is preserved. Ie, a weight of 5 over three cases will be - // distributed as weights of 2, 2, and 1. + // We only have one region counter for the entire set of cases here, so we + // need to divide the weights evenly between the generated cases, ensuring + // that the total weight is preserved. Ie, a weight of 5 over three cases + // will be distributed as weights of 2, 2, and 1. uint64_t Weight = Total / NCases, Rem = Total % NCases; for (unsigned I = 0; I != NCases; ++I) { if (SwitchWeights) -- cgit v1.2.3