]> granicus.if.org Git - clang/commitdiff
CodeGen: Clarify a comment about PGO in case statement ranges
authorJustin Bogner <mail@justinbogner.com>
Mon, 13 Jan 2014 21:24:25 +0000 (21:24 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 13 Jan 2014 21:24:25 +0000 (21:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199140 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp

index 79db418486845e81b4c2986353583937670a9c88..880e801189a8371bbff4e38f59707dd89f10e67b 100644 (file)
@@ -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)