[llvm] [DebugInfo][RemoveDIs] Implement redundant elimination for DPValues (PR #72284)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 06:49:52 PST 2023


================
@@ -440,7 +471,39 @@ static bool removeRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
 ///
 /// Possible improvements:
 /// - Keep track of non-overlapping fragments.
+static bool DPValuesRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) {
+  SmallVector<DPValue *, 8> ToBeRemoved;
+  DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>>
+      VariableMap;
+  for (auto &I : *BB) {
+    for (DPValue &DPV : I.getDbgValueRange()) {
+      DebugVariable Key(DPV.getVariable(),
+                        std::nullopt,
+                        DPV.getDebugLoc()->getInlinedAt());
----------------
jmorse wrote:

Ah cool, for some reason my mind removed the "then ignore this" wording and thought it was a direct suggestion. Indeed, IMO keeping identical-ness is more important at this stage.

https://github.com/llvm/llvm-project/pull/72284


More information about the llvm-commits mailing list