[PATCH] D13308: Value profiling - remaining LLVM changes

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 23:01:36 PST 2015


davidxl added inline comments.

================
Comment at: include/llvm/ProfileData/InstrProfReader.h:158-159
@@ +157,4 @@
+    const uint64_t ValueDataSize;
+  };
+  struct ValueData {
+    const uint64_t Value;
----------------
Use the existing type InstrProfValueData instead.

================
Comment at: include/llvm/ProfileData/InstrProfReader.h:294
@@ +293,3 @@
+  /// value profiling kind
+  std::error_code getFunctionValuesForKind(StringRef FuncName,
+      uint64_t FuncHash, uint32_t ValueKind,
----------------
There is a new interface getInstrProfRecord which can used to return InstrProfRecord which has all the necessary interfaces to access value profile data.

================
Comment at: lib/ProfileData/InstrProfReader.cpp:243
@@ -236,3 +242,3 @@
   ptrdiff_t DataOffset = sizeof(RawHeader);
   ptrdiff_t CountersOffset = DataOffset + sizeof(ProfileData) * DataSize;
   ptrdiff_t NamesOffset = CountersOffset + sizeof(uint64_t) * CountersSize;
----------------
To be compatible with profile data with different number of value profile kinds (assuming profile kind enum has fixed encoding), the size of ProfileData is not static, but depends on the record # of ValueKinds.


uint64_t ProfileDataSize = sizeof(ProfileData) + (ValueKindLast - ...)*sizeof(uint32_t);

The profileData def also needs to move the variable length array to the last field.

================
Comment at: lib/ProfileData/InstrProfReader.cpp:551
@@ -485,1 +550,3 @@
 
+std::error_code IndexedInstrProfReader::getFunctionValuesForKind(
+  StringRef FuncName, uint64_t FuncHash, uint32_t ValueKind,
----------------
No need for this function.


http://reviews.llvm.org/D13308





More information about the llvm-commits mailing list