[PATCH] D13308: Value profiling - remaining LLVM changes

David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 18:33:31 PST 2015


davidxl added inline comments.

================
Comment at: lib/ProfileData/InstrProfReader.cpp:286
@@ +285,3 @@
+std::error_code RawInstrProfReader<IntPtrT>::readValueData(
+    InstrProfRecord &Record) {
+
----------------
This function will become only a couple of lines long if ValueProfileData is used as the format for Raw format too. Something like:


support::endian::Endianess SrcEndianness = getDataEndianess(shouldSwapBytes, getHostEndianNess());
.. VDataOrError = ValueProfData::getValueProfData(Data->Values, End, SrcEndianness);
if (std::error_code EC = VDataOrError.getError())
        return EC;
VDataOrErr.get()->deserializeTo(Record, ...);



================
Comment at: lib/Transforms/Instrumentation/InstrProfiling.cpp:331
@@ +330,3 @@
+                           ConstantExpr::getBitCast(Fn, Int8PtrTy) :
+                           ConstantPointerNull::get(Int8PtrTy);
+
----------------
Move the whole expression into the .inc file for clarity. If it is too long, more this out of the function as an inline helper function and call the function in .inc file. The expression does not fit here (without context how it is used).

inline Constant *getFuncAddr(..Fn) {
}

================
Comment at: lib/Transforms/Instrumentation/InstrProfiling.cpp:335
@@ +334,3 @@
+  for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
+    Int16ArrayVals[Kind] = ConstantInt::get(Int16Ty, PD.NumValueSites[Kind]);
+
----------------
Wrap the above and ConstantArray::get(Int16ArrayTy, Int16ArrayVals)) into one helper function, and reference the function call in .inc file.


http://reviews.llvm.org/D13308





More information about the llvm-commits mailing list