[PATCH] D148788: [NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsers

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 01:20:05 PDT 2023


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

The out-param vector from findDbgValues and findDbgUsers should not include duplicates, which is possible if the debug intrinsic uses the value multiple times. This filter is already in place for multiple uses in a `DIArgLists`; extend it to cover dbg.assigns too because a Value may be used in both the address and value components.

Alternatively: maybe the out-parameter should be a SmallSet? Assuming the result is iterated over I imagine the performance cost would overall be very low for the general case. But I don't have any numbers to back that up - I'm not sure what the distribution of sizes of the set are for any codebases.

Without this patch we hit an assertion in a fuchsia build: https://ci.chromium.org/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-release/b8783373381569070049/overview because `replaceVariableLocationOp` is called twice for the same intrinsic as a result of the issue mentioned above.  `replaceVariableLocationOp` asserts that an operand is actually changed by the call, and the second time its called this assertion fires as the first call replaced both uses of the value already. I'm also not 100% sure that we need that assertion in there - it seems fairly harmless to try to replace a value that isn't used by an intrinsic.


https://reviews.llvm.org/D148788

Files:
  llvm/lib/IR/DebugInfo.cpp
  llvm/unittests/Transforms/Utils/LocalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148788.515247.patch
Type: text/x-patch
Size: 4666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230420/242bca76/attachment.bin>


More information about the llvm-commits mailing list