[PATCH] D118715: [DebugInfo][InstrRef] Fix a tombstone-in-DenseMap crash from D117877

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 10:32:20 PST 2022


jmorse created this revision.
jmorse added reviewers: StephenTozer, Orlando, TWeaver.
Herald added a subscriber: hiraditya.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is a follow up to D117877 <https://reviews.llvm.org/D117877>: variable assignments of DBG_VALUE $noreg, or DBG_INSTR_REFs where no value can be found, are represented as a `DbgValue` object with Kind "Undef". This explicitly represents "There is no value for this, and never can be". In D117877 <https://reviews.llvm.org/D117877> I added a special-case to make some assignment accounting faster, without considering this scenario. It causes variables to be given the value `ValueIDNum::EmptyValue`, which would fail gracefully and wouldn't produce an illegal location, it'd just be discarded. However, recently that value began being entered into a DenseMap, where it's a tombstone value, causing assertions.

This patch handles that scenario and adds a regression test. The more general fix is to wrap `DbgValue`'s `ID` field in Optional<>, just like the `MachineOperand` field is, but I'm aiming for the minimal fix right now :(


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118715

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/test/DebugInfo/MIR/InstrRef/single-assign-propagation.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118715.404990.patch
Type: text/x-patch
Size: 4123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220201/23bc495a/attachment.bin>


More information about the llvm-commits mailing list