summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-01-13 21:24:25 +0000
committerJustin Bogner <mail@justinbogner.com>2014-01-13 21:24:25 +0000
commitd03479ea282c143eb21112762331764241ab371c (patch)
treeef9b4af6cd6aad445dc3031423233445db7ac912 /lib/CodeGen/CGStmt.cpp
parent1a92b70b61f43d59a8fa4c17808de5cab36f95e9 (diff)
downloadclang-d03479ea282c143eb21112762331764241ab371c.tar.gz
clang-d03479ea282c143eb21112762331764241ab371c.tar.bz2
clang-d03479ea282c143eb21112762331764241ab371c.tar.xz
CodeGen: Clarify a comment about PGO in case statement ranges
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r--lib/CodeGen/CGStmt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index 79db418486..880e801189 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/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)