r199140 - CodeGen: Clarify a comment about PGO in case statement ranges
Justin Bogner
mail at justinbogner.com
Mon Jan 13 13:24:26 PST 2014
Author: bogner
Date: Mon Jan 13 15:24:25 2014
New Revision: 199140
URL: http://llvm.org/viewvc/llvm-project?rev=199140&view=rev
Log:
CodeGen: Clarify a comment about PGO in case statement ranges
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=199140&r1=199139&r2=199140&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Jan 13 15:24:25 2014
@@ -999,9 +999,10 @@ void CodeGenFunction::EmitCaseStmtRange(
// 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)
More information about the cfe-commits
mailing list