[PATCH] D114603: [DebugInfo][InstrRef] Terminate variable locations when overlapping fragments are assigned

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 25 10:23:06 PST 2021


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.

In todays episode of "uncommon corner cases that LiveDebugValues handles": overlapping fragments. The modified test checks that if we have a variable where its fragments are split into overlapping segments:

  DBG_VALUE $ax, $noreg, !123, !DIExpression(DW_OP_LLVM_fragment_0, 16)
  ...
  DBG_VALUE $eax, $noreg, !123, !DIExpression(DW_OP_LLVM_fragment_0, 32)

that we only propagate the most recently assigned fragment out of a block. The test only deals with live-in variable locations, as overlaps within blocks is `DbgEntityHistoryCalculators` domain.

InstrRefBasedLDV needs to preserve this behaviour: we've kept the `accumulateFragmentMap` method from VarLocBasedLDV, we just need it to recognise DBG_INSTR_REFs. Once it's produce a mapping of variable / fragments to the overlapped variable / fragments, VLocTracker uses it to identify when a debug instruction needs to terminate the other parts it overlaps with.

The changes to live-debug-values-fragments.mir are:

- $ax switches to $cx in two scenarios, because it's a value copied from one register to another, doesn't matter which is used,
- The order of DBG_VALUEs produced changes with instruction referencing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114603

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
  llvm/test/DebugInfo/MIR/X86/live-debug-values-fragments.mir
  llvm/unittests/CodeGen/InstrRefLDVTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114603.389831.patch
Type: text/x-patch
Size: 8478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211125/f92b319a/attachment.bin>


More information about the llvm-commits mailing list