[llvm] r252563 - [PGO] Make indexed value profile data more compact

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 08:24:05 PST 2015


I should have a fix soon.

David

On Tue, Nov 10, 2015 at 8:10 AM, Diego Novillo <dnovillo at google.com> wrote:

>
>
> On Mon, Nov 9, 2015 at 7:24 PM, Xinliang David Li via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> +std::unique_ptr<ValueProfData>
>> +ValueProfData::serializeFrom(const InstrProfRecord &Record) {
>> +  uint32_t TotalSize = getSize(Record);
>> +  std::unique_ptr<ValueProfData> VPD(
>> +      reinterpret_cast<ValueProfData *>(new char[TotalSize]));
>>
>
> David, this is causing ASan failures on the LLVM testsuite.  Specifically,
> this allocation via new[] is then deallocated with just delete by the
> runtime std::unique_ptr support.  So, ASan complains with:
>
>  ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs
> operator delete) on 0x60200000ee90
>
>     #0 0x4de26b in operator delete(void*) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:94:3
>     #1 0x7dfaf0 in std::unique_ptr<llvm::IndexedInstrProf::ValueProfData, std::default_delete<llvm::IndexedInstrProf::ValueProfData> >::~unique_ptr() [...]/bits/unique_ptr.h:236:4
>     #2 0x7fd8c6 in (anonymous namespace)::InstrProfRecordTrait::EmitData(llvm::raw_ostream&, llvm::StringRef, llvm::SmallDenseMap<unsigned long, llvm::InstrProfRecord, 1u, llvm::DenseMapInfo<unsigned long>, llvm::detail::DenseMapPair<unsigned long, llvm::InstrProfRecord> > const*, unsigned long) llvm/lib/ProfileData/InstrProfWriter.cpp:85:5
>
> 0x60200000ee90 is located 0 bytes inside of 8-byte region [0x60200000ee90,0x60200000ee98)
> allocated by thread T0 here:
>     #0 0x4dde1b in operator new[](unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64:37
>     #1 0x7de5e1 in llvm::IndexedInstrProf::ValueProfData::serializeFrom(llvm::InstrProfRecord const&) llvm/lib/ProfileData/InstrProf.cpp:251:41
>     #2 0x7fd883 in (anonymous namespace)::InstrProfRecordTrait::EmitData(llvm::raw_ostream&, llvm::StringRef, llvm::SmallDenseMap<unsigned long, llvm::InstrProfRecord, 1u, llvm::DenseMapInfo<unsigned long>, llvm::detail::DenseMapPair<unsigned long, llvm::InstrProfRecord> > const*, unsigned long) llvm/lib/ProfileData/InstrProfWriter.cpp:81:11
>
>
>
> Not quite sure what the right fix for this usage pattern is wrt
> std::unique_ptr.  Mind if I revert the patch while you find a fix?
>
>
> Thanks.  Diego.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151110/26be8970/attachment.html>


More information about the llvm-commits mailing list