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

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 16:28:58 PST 2015


looking into it.

thanks,

David

On Mon, Nov 16, 2015 at 3:58 PM, Bruno Cardoso Lopes <
bruno.cardoso at gmail.com> wrote:

> Hi David,
>
> There are also ubsan errors due to this commit.
> More info:
> http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_check/707/consoleFull#-51045544449ba4694-19c4-4d7e-bec5-911270d8a58c
> But it affects all builds up to today.
>
> One example:
>
> FAIL: Clang :: Profile/c-attributes.c (5211 of 24157)
> ******************** TEST 'Clang :: Profile/c-attributes.c' FAILED
> ********************
> Script:
> --
> llvm-profdata merge
> /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /llvm/tools/clang/test/Profile/Inputs/c-attributes.proftext
> -o /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /clang-build/tools/clang/test/Profile/Output/c-attributes.c.tmp.profdata
> /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /clang-build/./bin/clang
>  /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /llvm/tools/clang/test/Profile/c-attributes.c
> -o - -mllvm -disable-llvm-optzns -emit-llvm -S
>
> -fprofile-instr-use=/Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /clang-build/tools/clang/test/Profile/Output/c-attributes.c.tmp.profdata
> | /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /clang-build/./bin/FileCheck
> /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /llvm/tools/clang/test/Profile/c-attributes.c
> --
> Exit Code: 2
>
> Command Output (stderr):
> --
> /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /llvm/lib/ProfileData/InstrProf.cpp:275:7:
> runtime error: load of misaligned address 0x61a00001dc89 for type
> 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte
> alignment
> 0x61a00001dc89: note: pointer points here
>  00 00 00  00 08 00 00 00 00 00 00  00 01 00 fa d5 8d e7 36  64 95 db
> 04 00 00 00 00  00 00 00 48 00
>               ^
> SUMMARY: AddressSanitizer: undefined-behavior
> /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-RgSan at 2
> /llvm/lib/ProfileData/InstrProf.cpp:275:7
> in
> 0  clang-3.8                          0x00000001108e0f6e
> llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 286
> 1  clang-3.8                          0x00000001108df0c5
> llvm::sys::RunSignalHandlers() + 213
> 2  clang-3.8                          0x00000001108e2216
> SignalHandler(int) + 662
> 3  libsystem_platform.dylib           0x00007fff8d239f1a _sigtramp + 26
> 4  libsystem_platform.dylib           0x00007fff69298784 _sigtramp +
> 3691374724
> 5  libsystem_c.dylib                  0x00007fff88edd9b3 abort + 129
> 6  libclang_rt.asan_osx_dynamic.dylib 0x000000011d14f8d6
> __sanitizer::Abort() + 6
> Stack dump:
>
> But there are total of 30 failing tests:
>
> Failing Tests (30):
>     Clang :: Profile/c-attributes.c
>     Clang :: Profile/c-captured.c
>     Clang :: Profile/c-counter-overflows.c
>     Clang :: Profile/c-general.c
>     Clang :: Profile/c-outdated-data.c
>     Clang :: Profile/c-unprofiled-blocks.c
>     Clang :: Profile/cxx-class.cpp
>     Clang :: Profile/cxx-lambda.cpp
>     Clang :: Profile/cxx-rangefor.cpp
>     Clang :: Profile/cxx-templates.cpp
>     Clang :: Profile/func-entry.c
>     Clang :: Profile/gcc-flag-compatibility.c
>     Clang :: Profile/objc-general.m
>     LLVM :: tools/llvm-cov/binary-formats.c
>     LLVM :: tools/llvm-cov/showLineExecutionCounts.cpp
>     LLVM :: tools/llvm-cov/showRegionMarkers.cpp
>     LLVM :: tools/llvm-cov/universal-binary.c
>     LLVM :: tools/llvm-profdata/count-mismatch.proftext
>     LLVM :: tools/llvm-profdata/general.proftext
>     LLVM :: tools/llvm-profdata/hash-mismatch.proftext
>     LLVM :: tools/llvm-profdata/multiple-inputs.test
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/CoverageMappingTest.basic_coverage_iteration
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/CoverageMappingTest.combine_regions
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/CoverageMappingTest.dont_combine_expansions
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/InstrProfTest.get_function_counts
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/InstrProfTest.get_icall_data_merge1
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/InstrProfTest.get_icall_data_read_write
>     LLVM-Unit ::
>
> ProfileData/ProfileDataTests/InstrProfTest.get_icall_data_read_write_big_endian
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/InstrProfTest.get_instr_prof_record
>     LLVM-Unit ::
> ProfileData/ProfileDataTests/InstrProfTest.write_and_read_one_function
>
> On Tue, Nov 10, 2015 at 8:30 AM, Diego Novillo via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Thanks!
> >
> > On Nov 10, 2015 11:24, "Xinliang David Li" <davidxl at google.com> wrote:
> >>
> >> 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.
> >>
> >>
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
>
>
>
> --
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151116/d33528ff/attachment.html>


More information about the llvm-commits mailing list