]> granicus.if.org Git - clang/commitdiff
PGO: fix a bug in parsing pgo data.
authorManman Ren <manman.ren@gmail.com>
Sat, 15 Feb 2014 01:29:02 +0000 (01:29 +0000)
committerManman Ren <manman.ren@gmail.com>
Sat, 15 Feb 2014 01:29:02 +0000 (01:29 +0000)
When a function has a single counter, we will offset the pointer by 1 when
parsing the next function. If a function has multiple counters, we are
okay after skipping rest of the counters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201456 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenPGO.cpp
test/CodeGen/Inputs/instr-profile.pgodata

index d7c4709612aac2c8dd3a735877b5994936979a45..5475342ecddf2c99f705f3919131cfda37341ea4 100644 (file)
@@ -72,7 +72,7 @@ PGOProfileData::PGOProfileData(CodeGenModule &CGM, std::string Path)
       ReportBadPGOData(CGM, "pgo-data file has bad count value");
       return;
     }
-    CurPtr = EndPtr + 1;
+    CurPtr = EndPtr; // Point to '\n'.
     FunctionCounts[MangledName] = Count;
     MaxCount = Count > MaxCount ? Count : MaxCount;
 
index 578a6d24e56775619b9a19affdf25e359da8e589..0eaea30ae21b3066c9fe2ee10c837dd4b5f2473d 100644 (file)
@@ -116,6 +116,9 @@ big_switch 19
 2
 2
 
+issue_with_one_counter 1
+0
+
 boolean_operators 10
 1
 100