r201456 - PGO: fix a bug in parsing pgo data.

Manman Ren manman.ren at gmail.com
Fri Feb 14 17:29:02 PST 2014


Author: mren
Date: Fri Feb 14 19:29:02 2014
New Revision: 201456

URL: http://llvm.org/viewvc/llvm-project?rev=201456&view=rev
Log:
PGO: fix a bug in parsing pgo data.

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.


Modified:
    cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
    cfe/trunk/test/CodeGen/Inputs/instr-profile.pgodata

Modified: cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenPGO.cpp?rev=201456&r1=201455&r2=201456&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenPGO.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenPGO.cpp Fri Feb 14 19:29:02 2014
@@ -72,7 +72,7 @@ PGOProfileData::PGOProfileData(CodeGenMo
       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;
 

Modified: cfe/trunk/test/CodeGen/Inputs/instr-profile.pgodata
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/instr-profile.pgodata?rev=201456&r1=201455&r2=201456&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/Inputs/instr-profile.pgodata (original)
+++ cfe/trunk/test/CodeGen/Inputs/instr-profile.pgodata Fri Feb 14 19:29:02 2014
@@ -116,6 +116,9 @@ big_switch 19
 2
 2
 
+issue_with_one_counter 1
+0
+
 boolean_operators 10
 1
 100





More information about the cfe-commits mailing list