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.
Now that the body of the loops is identical between DIArgLists and LocalAsMetadatas, could you refactor this into a lambda/delegate to reduce duplication.