Implement the removeRedundantDbgInstrs cleanup from lib/Transforms/Utils/BasicBlockUtils.cpp for FunctionVarLocBuilder's variable location definitions.
Removing redundant entries has the obvious benefits of reducing peak memory when using the results of the analysis and reducing the final number of MIR debug instructions.
It also has a less obvious benefit. This patch is not an NFC change because SelectionDAG has a habit of doing Bad Things with variable locations - removing the number of location definitions tends to reduce the number of Bad Things.
Two examples I have seen:
- Argument SDDbgValues hoisted above undef `SDDbgValues.
- undef SDDbgValues in a block of contiguous SDDbgValues spuriously changing order.
Tests coming in a later patch.
Ideally Key would be a reference to avoid any un-necessary copying, I think doing that hinges on feedback in the parent patch.