[PATCH] D13843: Use ProfileData/InstrProfData.inc template file to define PGO runtime types
David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 3 21:17:42 PST 2015
davidxl marked 3 inline comments as done.
================
Comment at: lib/ProfileData/CoverageMappingReader.cpp:370
@@ +369,3 @@
+ const coverage::CovMapFunctionRecord<T> *CFR =
+ reinterpret_cast<const coverage::CovMapFunctionRecord<T> *>(FunBuf);
+ while ((const char *)CFR < FunEnd) {
----------------
vsk wrote:
> I notice that the old code used unaligned accesses when unpacking `FunBuf`.
>
> I think having an assertion here for the assumed alignment would make for good future-proofing. Could we assert that CFR->FuncHash is 8-byte aligned?
>
Actually on 32bit target, CFR->FuncHash is not 8 byte aligned. To support reading coverage data produced by 32bit target on a 64bit host, the CovMapFunctionRecord struct (instantiated with 32 bit IntPtrT for 32bit target) needs to be declared with __attribute__((packed)). The attribute does not affect this struct's native layout.
http://reviews.llvm.org/D13843
More information about the llvm-commits
mailing list