[PATCH] D128212: [DebugInfo] Extend the InstrRef LDV to support DbgValues with many Ops

Nathan Chancellor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 10:30:17 PDT 2022


nathanchance added a comment.

I too saw a crash in the Linux kernel with this change (no KMSAN), my reduction just finished:

  struct rb_node {
    long __rb_parent_color;
  } rb_erase(struct rb_node *, int *);
  struct journal_node {
    struct rb_node node;
    long sector;
  } * do_journal_write_ic_0;
  short page_list_location_ic_2;
  int page_list_location_section, page_list_location_pl_offset,
      remove_journal_node_ic_1;
  int *access_journal___trans_tmp_5;
  unsigned do_journal_write_i;
  void remove_journal_node(struct journal_node *node) {
    if (__builtin_expect((&node->node)->__rb_parent_color == (long)node, 0))
      asm(".pushsection __bug_table,\"aw\"\n"
          ".popsection\n");
    rb_erase(&node->node, &remove_journal_node_ic_1);
  }
  _Bool find_newer_committed_node(struct journal_node *);
  void do_journal_write() {
    unsigned j;
    for (;;) {
      unsigned k;
      struct journal_node *section_node =
          &do_journal_write_ic_0[do_journal_write_i];
      while (j < k && find_newer_committed_node(&section_node[j])) {
        unsigned sector =
            page_list_location_section * page_list_location_ic_2 + j;
        page_list_location_pl_offset = sector << *access_journal___trans_tmp_5;
        remove_journal_node(&section_node[j]);
        j++;
      }
      while (k && find_newer_committed_node(&section_node[k]))
        k--;
    }
  }



  $ clang -O2 -gdwarf-5 -c -o /dev/null dm-integrity.i
  clang: /home/nathan/cbl/src/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp:810: void TransferTracker::clobberMloc(LocIdx, ValueIDNum, MachineBasicBlock::iterator, bool): Assertion `LostMLocIt->second.contains(LocVarIt.second) && "Variable was using
   this MLoc, but does not appear in " "ActiveMLocs?"' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.      Program arguments: clang -O2 -gdwarf-5 -c -o /dev/null dm-integrity.i
  1.      <eof> parser at end of file
  2.      Code generation
  3.      Running pass 'Function Pass Manager' on module 'dm-integrity.i'.
  4.      Running pass 'Live DEBUG_VALUE analysis' on function '@do_journal_write'
   #0 0x000055e8015a8a03 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x312da03)
   #1 0x000055e8015a6a4e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x312ba4e)
   #2 0x000055e80152bacf (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
   #3 0x000055e80152bce1 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
   #4 0x00007f6e6dc1da40 (/usr/lib/libc.so.6+0x38a40)
   #5 0x00007f6e6dc6d4dc (/usr/lib/libc.so.6+0x884dc)
   #6 0x00007f6e6dc1d998 raise (/usr/lib/libc.so.6+0x38998)
   #7 0x00007f6e6dc0753d abort (/usr/lib/libc.so.6+0x2253d)
   #8 0x00007f6e6dc0745c (/usr/lib/libc.so.6+0x2245c)
   #9 0x00007f6e6dc164c6 (/usr/lib/libc.so.6+0x314c6)
  #10 0x000055e800d383a8 TransferTracker::clobberMloc(LiveDebugValues::LocIdx, LiveDebugValues::ValueIDNum, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, bool) InstrRefBasedImpl.cpp:0:0
  #11 0x000055e800d3647d LiveDebugValues::InstrRefBasedLDV::transferSpillOrRestoreInst(llvm::MachineInstr&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x28bb47d)
  #12 0x000055e800d47e83 LiveDebugValues::InstrRefBasedLDV::depthFirstVLocAndEmit(unsigned int, llvm::DenseMap<llvm::LexicalScope const*, llvm::DILocation const*, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::DILocation const*>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>>>&, llvm::SmallVector<llvm::SmallVector<std::pair<llvm::DebugVariable, LiveDebugValues::DbgValue>, 8u>, 8u>&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> []>>&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> []>>&, llvm::SmallVectorImpl<LiveDebugValues::VLocTracker>&, llvm::MachineFunction&, llvm::DenseMap<llvm::DebugVariable, unsigned int, llvm::DenseMapInfo<llvm::DebugVariable, void>, llvm::detail::DenseMapPair<llvm::DebugVariable, unsigned int>>&, llvm::TargetPassConfig const&)::$_13::operator()(llvm::MachineBasicBlock&) const InstrRefBasedImpl.cpp:0:0
  #13 0x000055e800d4782d LiveDebugValues::InstrRefBasedLDV::depthFirstVLocAndEmit(unsigned int, llvm::DenseMap<llvm::LexicalScope const*, llvm::DILocation const*, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::DILocation const*>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallSet<llvm::DebugVariable, 4u, std::less<llvm::DebugVariable>>>> const&, llvm::DenseMap<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>, llvm::DenseMapInfo<llvm::LexicalScope const*, void>, llvm::detail::DenseMapPair<llvm::LexicalScope const*, llvm::SmallPtrSet<llvm::MachineBasicBlock*, 4u>>>&, llvm::SmallVector<llvm::SmallVector<std::pair<llvm::DebugVariable, LiveDebugValues::DbgValue>, 8u>, 8u>&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> []>>&, std::unique_ptr<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> [], std::default_delete<std::unique_ptr<LiveDebugValues::ValueIDNum [], std::default_delete<LiveDebugValues::ValueIDNum []>> []>>&, llvm::SmallVectorImpl<LiveDebugValues::VLocTracker>&, llvm::MachineFunction&, llvm::DenseMap<llvm::DebugVariable, unsigned int, llvm::DenseMapInfo<llvm::DebugVariable, void>, llvm::detail::DenseMapPair<llvm::DebugVariable, unsigned int>>&, llvm::TargetPassConfig const&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x28cc82d)
  #14 0x000055e800d4a189 LiveDebugValues::InstrRefBasedLDV::ExtendRanges(llvm::MachineFunction&, llvm::MachineDominatorTree*, llvm::TargetPassConfig*, unsigned int, unsigned int) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x28cf189)
  #15 0x000055e8009b3989 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x2538989)
  #16 0x000055e800e8c5b7 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x2a115b7)
  #17 0x000055e800e94061 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x2a19061)
  #18 0x000055e800e8cfc5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x2a11fc5)
  #19 0x000055e801dfb46d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x398046d)
  #20 0x000055e8021f8a5e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
  #21 0x000055e802b0447a clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x468947a)
  #22 0x000055e80213b3d0 clang::FrontendAction::Execute() (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3cc03d0)
  #23 0x000055e8020ad53f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3c3253f)
  #24 0x000055e8021f1ec2 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3d76ec2)
  #25 0x000055e80030901a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x1e8e01a)
  #26 0x000055e800306daf ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
  #27 0x000055e801f28b72 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
  #28 0x000055e80152b94c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x30b094c)
  #29 0x000055e801f286d0 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3aad6d0)
  #30 0x000055e801ee7d5f clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3a6cd5f)
  #31 0x000055e801ee800e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3a6d00e)
  #32 0x000055e801f04e80 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x3a89e80)
  #33 0x000055e80030647b clang_main(int, char**) (/home/nathan/tmp/tmp.gmGKPVYoUk/install/llvm/2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a/bin/clang-16+0x1e8b47b)
  #34 0x00007f6e6dc082d0 (/usr/lib/libc.so.6+0x232d0)
  #35 0x00007f6e6dc0838a __libc_start_main (/usr/lib/libc.so.6+0x2338a)
  #36 0x000055e8003039e5 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
  clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
  ClangBuiltLinux clang version 16.0.0 (https://github.com/llvm/llvm-project 2cb9e1ac422f46de0ab728c6c9d50ebafbfe372a)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: ...
  clang-16: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

The parent commit is fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128212



More information about the llvm-commits mailing list