[PATCH] D136173: [DebugInfo] Add function to test debug values for equivalence

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 07:15:22 PDT 2022


StephenTozer created this revision.
StephenTozer added reviewers: jmorse, djtodoro.
StephenTozer added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
StephenTozer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Debug values in both IR and MIR have 3 distinct properties that are used to compute the underlying variable value; the DIExpression, a list of one or more machine value(s), and a "directness" flag, given by either the choice of intrinsic in IR (`dbg.declare/dbg.addr` being indirect, `dbg.value` being direct), or directly specified as an operand in MIR (the second operand to a `DBG_VALUE` instruction). The expressions themselves may optionally be variadic, which allows for more than one machine value to be used in the debug value, and changes the expression syntax to explicitly specify where in the expression those machine values appear, instead of implicitly inserting the sole machine value at the front of the expression.

This patch adds a new function that can be used to check all the properties, other than the machine values, of a pair of debug values for equivalence. This is done by folding the "directness" into the expression, converting the expression to variadic form if it is not already in that form, and then comparing directly. In a few places which check whether two debug values are identical to see if their ranges can be merged, this function will correctly identify cases where two debug values are expressed differently but have the same meaning, allowing those ranges to be correctly merged.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136173

Files:
  llvm/include/llvm/CodeGen/MachineInstr.h
  llvm/include/llvm/IR/DebugInfoMetadata.h
  llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
  llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
  llvm/lib/CodeGen/MachineInstr.cpp
  llvm/lib/IR/DebugInfoMetadata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136173.468528.patch
Type: text/x-patch
Size: 11614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221018/812b4a5c/attachment.bin>


More information about the llvm-commits mailing list