[llvm] [RemoveDIs][DebugInfo] Handle DPVAssign in most transforms (PR #78986)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 08:42:09 PST 2024


================
@@ -134,13 +156,17 @@ class AssignmentTrackingInfo {
     // dbg.assign for each variable fragment for the untracked store handling
     // (after this loop).
     SmallSet<DebugVariableAggregate, 2> VarHasDbgAssignForStore;
-    for (DbgAssignIntrinsic *DAI : at::getAssignmentMarkers(ToDelete)) {
-      VarHasDbgAssignForStore.insert(DebugVariableAggregate(DAI));
-      DbgAssignsToDelete->insert(DAI);
-      DIB.insertDbgValueIntrinsic(DAI->getValue(), DAI->getVariable(),
-                                  DAI->getExpression(), DAI->getDebugLoc(),
-                                  DAI);
-    }
+    auto InsertValueForAssign = [&](auto *DbgAssign, auto *&AssignList) {
+      VarHasDbgAssignForStore.insert(DebugVariableAggregate(DbgAssign));
+      AssignList->insert(DbgAssign);
+      createDebugValue(DIB, DbgAssign->getValue(), DbgAssign->getVariable(),
+                       DbgAssign->getExpression(), DbgAssign->getDebugLoc(),
+                       DbgAssign);
+    };
+    for (auto *Assign : at::getAssignmentMarkers(ToDelete))
----------------
SLTozer wrote:

I decided against it in this case, because we don't have a function that takes a single argument - the only way to use for_each in this case would be a separate lambda for intrinsics and DPValues, which would make the code less simple rather than more.

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


More information about the llvm-commits mailing list