InstrProf: Fix reading of consecutive 32 bit coverage maps
authorJustin Bogner <mail@justinbogner.com>
Fri, 5 Jun 2015 01:23:42 +0000 (01:23 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 5 Jun 2015 01:23:42 +0000 (01:23 +0000)
commit0a64b6de98556684889f1f63a418ba4496588b0c
treea7856cad9d14381d82f74786fe9a27164e0026d4
parent85529a57b457a7ac8cf498da7ce07acb92d4be37
InstrProf: Fix reading of consecutive 32 bit coverage maps

When we generate coverage data, we explicitly set each coverage map's
alignment to 8 (See InstrProfiling::lowerCoverageData), but when we
read the coverage data, we assume consecutive maps are exactly
adjacent. When we're dealing with 32 bit, maps can end on a 4 byte
boundary, causing us to think the padding is part of the next record.

Fix this by adjusting the buffer to an appropriately aligned address
between records.

This is pretty awkward to test, as it requires a binary with multiple
coverage maps to hit, so we'd need to check in multiple source files
and a binary blob as inputs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239129 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/MathExtras.h
lib/ProfileData/CoverageMappingReader.cpp