[PATCH] D147740: [llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed using MD5 as key to Sample Profile map

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 21 17:42:09 PDT 2023


ayermolo added a comment.

This diff is causing clang to crash on one of our builds, when clang is linked with jemalloc.
-DCMAKE_EXE_LINKER_FLAGS="-L /usr/lib64 -Wl,-rpath,/usr/lib64 -ljemalloc" \

I am trying to come up with small repro, but in meantime can this diff be reverted?

Full stack trace:

   #0 0x000055b18add6a58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13
   #1 0x000055b18add4950 llvm::sys::RunSignalHandlers() /home/ayermolo/local/upstream-llvm/llvm-project/llvm/lib/Support/Signals.cpp:106:18
   #2 0x000055b18add722d SignalHandler(int) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
   #3 0x00007ffaa7812cf0 __restore_rt (/usr/lib64/libpthread.so.0+0x12cf0)
   #4 0x000055b18c0c9033 llvm::sampleprof::LineLocation::operator<(llvm::sampleprof::LineLocation const&) const /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h:296:23
   #5 0x000055b18c0c9033 std::less<llvm::sampleprof::LineLocation>::operator()(llvm::sampleprof::LineLocation const&, llvm::sampleprof::LineLocation const&) const /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_function.h:408:20
   #6 0x000055b18c0c9033 std::_Rb_tree<llvm::sampleprof::LineLocation, std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>, std::_Select1st<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>>, std::less<llvm::sampleprof::LineLocation>, std::allocator<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>>>::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>>, llvm::sampleprof::LineLocation const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_tree.h:2220:11
   #7 0x000055b18c0caf2d std::_Rb_tree_iterator<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>> std::_Rb_tree<llvm::sampleprof::LineLocation, std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>, std::_Select1st<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>>, std::less<llvm::sampleprof::LineLocation>, std::allocator<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<llvm::sampleprof::LineLocation&&>, std::tuple<>>(std::_Rb_tree_const_iterator<std::pair<llvm::sampleprof::LineLocation const, llvm::sampleprof::SampleRecord>>, std::piecewise_construct_t const&, std::tuple<llvm::sampleprof::LineLocation&&>&&, std::tuple<>&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_tree.h:2462:15
   #8 0x000055b18c0c9bfb llvm::sampleprof::FunctionSamples::addBodySamples(unsigned int, unsigned int, unsigned long, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_map.h:0:15
   #9 0x000055b18c0c6d27 llvm::sampleprof::ProfileConverter::flattenNestedProfile(llvm::sampleprof::SampleProfileMap&, llvm::sampleprof::FunctionSamples const&) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h:1599:21
  #10 0x000055b18c0c659f llvm::sampleprof::ProfileConverter::flattenProfile(llvm::sampleprof::SampleProfileMap const&, llvm::sampleprof::SampleProfileMap&, bool) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/ProfileData/SampleProf.h:0:9
  #11 0x000055b18c0c0e28 std::__uniq_ptr_impl<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>>::reset((anonymous namespace)::SampleProfileMatcher*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:200:26
  #12 0x000055b18c0c0e28 std::__uniq_ptr_impl<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>>::operator=(std::__uniq_ptr_impl<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>>&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:183:2
  #13 0x000055b18c0c0e28 std::__uniq_ptr_data<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>, true, true>::operator=(std::__uniq_ptr_data<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>, true, true>&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:235:61
  #14 0x000055b18c0c0e28 std::unique_ptr<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>>::operator=(std::unique_ptr<(anonymous namespace)::SampleProfileMatcher, std::default_delete<(anonymous namespace)::SampleProfileMatcher>>&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:406:51
  #15 0x000055b18c0c0e28 (anonymous namespace)::SampleProfileLoader::doInitialization(llvm::Module&, llvm::AnalysisManager<llvm::Function>*) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2104:21
  #16 0x000055b18c0c0e28 llvm::SampleProfileLoaderPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2632:21
  #17 0x000055b18bfcfb0d llvm::detail::PassModel<llvm::Module, llvm::SampleProfileLoaderPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:89:5
  #18 0x000055b18a95e3b9 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:521:10
  #19 0x000055b18b4f33ff llvm::SmallPtrSetImplBase::isSmall() const /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:195:33
  #20 0x000055b18b4f33ff llvm::SmallPtrSetImplBase::~SmallPtrSetImplBase() /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/ADT/SmallPtrSet.h:83:10
  #21 0x000055b18b4f33ff llvm::PreservedAnalyses::~PreservedAnalyses() /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/IR/PassManager.h:152:7
  #22 0x000055b18b4f33ff (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1101:5
  #23 0x000055b18b4eaa22 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:0:3
  #24 0x000055b18b4eaa22 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1321:13
  #25 0x000055b18b95a8f5 std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>::~unique_ptr() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/unique_ptr.h:395:6
  #26 0x000055b18b95a8f5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:386:7
  #27 0x000055b18cf852c6 __gnu_cxx::__normal_iterator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>*, std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>>::__normal_iterator(std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>* const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_iterator.h:1073:20
  #28 0x000055b18cf852c6 std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>::begin() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:869:16
  #29 0x000055b18cf852c6 void clang::finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>>(std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>&, clang::Sema const&) /home/ayermolo/local/upstream-llvm/llvm-project/clang/include/clang/Sema/TemplateInstCallback.h:54:16
  #30 0x000055b18cf852c6 clang::ParseAST(clang::Sema&, bool, bool) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/Parse/ParseAST.cpp:183:3
  #31 0x000055b18b881b10 clang::FrontendAction::Execute() /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1067:10
  #32 0x000055b18b7fdc3d llvm::Error::getPtr() const /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/Support/Error.h:270:42
  #33 0x000055b18b7fdc3d llvm::Error::operator bool() /home/ayermolo/local/upstream-llvm/llvm-project/llvm/include/llvm/Support/Error.h:233:16
  #34 0x000055b18b7fdc3d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1054:23
  #35 0x000055b18b953335 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:25
  #36 0x000055b189dc769c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/ayermolo/local/upstream-llvm/llvm-project/clang/tools/driver/cc1_main.cpp:249:15
  #37 0x000055b189dc479a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/ayermolo/local/upstream-llvm/llvm-project/clang/tools/driver/driver.cpp:366:12
  #38 0x000055b189dc3732 clang_main(int, char**, llvm::ToolContext const&) /home/ayermolo/local/upstream-llvm/llvm-project/clang/tools/driver/driver.cpp:407:12
  #39 0x000055b189dd2d71 main /home/ayermolo/local/llvm-build-upstream-release/tools/clang/tools/driver/clang-driver.cpp:15:3
  #40 0x00007ffaa583ad85 __libc_start_main (/usr/lib64/libc.so.6+0x3ad85)
  #41 0x000055b189dc102e _start (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x2a6a02e)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147740/new/

https://reviews.llvm.org/D147740



More information about the llvm-commits mailing list