[PATCH] D105831: [DebugInfo] Fix incorrect handling of debug values with duplicate location operands

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 11:32:27 PDT 2021


StephenTozer created this revision.
StephenTozer added reviewers: aprantl, djtodoro, vsk, dblaikie.
StephenTozer added a project: debug-info.
Herald added subscribers: hiraditya, kristof.beyls.
StephenTozer requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch fixes several errors found by searching for code that does not correctly handle `dbg.value`s with duplicate operands, such as `DIArgList(i32 %a, i32 %a)`, following from the more specific errors found in D105129 <https://reviews.llvm.org/D105129>.

There are 2 types of errors fixed in this patch:

- The errors in `llvm::salvageDebugInfoForDbgValues` and `HWAddressSanitizer::instrumentStack` are caused by applying an update to the `dbg.value` for only the first instance of a duplicated operand, when the update needs to be applied for each instance.
- The errors in `HWAddressSanitizer::sanitizeFunction` and `AArch64StackTagging::runOnFunction` are caused by tracking values in the `dbg.value` that need to be replaced later, and then trying to replace the duplicated operand multiple times when it should only be replaced once.

In the longer term it will probably be easier to prevent duplicated operands from existing at all, but doing so requires further changes to prevent a `DIArgList` and its associated `DIExpression` from falling out of sync with each other. This can mostly be handled in `DbgVariableIntrinsic` and `DIArgList::handleUpdatedOperand`, but there are exceptions that may require a design change (such as joining the `DIArgList` and `DIExpression` in a single MDNode) to be handled in a generalized manner.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105831

Files:
  llvm/lib/Target/AArch64/AArch64StackTagging.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/CodeGen/AArch64/stack-tagging-dbg.ll
  llvm/test/DebugInfo/salvage-duplicate-values.ll
  llvm/test/Instrumentation/HWAddressSanitizer/alloca.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105831.357997.patch
Type: text/x-patch
Size: 8657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210712/0859a06f/attachment.bin>


More information about the llvm-commits mailing list