[llvm] 44e03d6 - [Assignment Tracking] Allow salvaging with variadic expressions [4/x]

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 02:56:05 PDT 2023


Author: OCHyams
Date: 2023-03-16T09:55:15Z
New Revision: 44e03d64881730430c83aee9bff95f1d855660f8

URL: https://github.com/llvm/llvm-project/commit/44e03d64881730430c83aee9bff95f1d855660f8
DIFF: https://github.com/llvm/llvm-project/commit/44e03d64881730430c83aee9bff95f1d855660f8.diff

LOG: [Assignment Tracking] Allow salvaging with variadic expressions [4/x]

Allow the value-component of a dbg.assign to be salvaged using a variadic
DIExpression.

Reviewed By: StephenTozer

Differential Revision: https://reviews.llvm.org/D145915

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/Local.cpp
    llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index ad312e45d7fe3..3f486147564ee 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1913,17 +1913,14 @@ void llvm::salvageDebugInfoForDbgValues(
     bool IsValidSalvageExpr = SalvagedExpr->getNumElements() <= MaxExpressionSize;
     if (AdditionalValues.empty() && IsValidSalvageExpr) {
       DII->setExpression(SalvagedExpr);
-    } else if (isa<DbgValueInst>(DII) && !isa<DbgAssignIntrinsic>(DII) &&
-               IsValidSalvageExpr &&
+    } else if (isa<DbgValueInst>(DII) && IsValidSalvageExpr &&
                DII->getNumVariableLocationOps() + AdditionalValues.size() <=
                    MaxDebugArgs) {
       DII->addVariableLocationOps(AdditionalValues, SalvagedExpr);
     } else {
       // Do not salvage using DIArgList for dbg.declare, as it is not currently
-      // supported in those instructions. Do not salvage using DIArgList for
-      // dbg.assign yet. FIXME: support this.
-      // Also do not salvage if the resulting DIArgList would contain an
-      // unreasonably large number of values.
+      // supported in those instructions. Also do not salvage if the resulting
+      // DIArgList would contain an unreasonably large number of values.
       DII->setKillLocation();
     }
     LLVM_DEBUG(dbgs() << "SALVAGE: " << *DII << '\n');

diff  --git a/llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll b/llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
index 29d5770211bd0..ba591b1aa5425 100644
--- a/llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
+++ b/llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
@@ -14,9 +14,8 @@ entry:
 
  %add1 = add nsw i32 %x, %y, !dbg !29
  call void @llvm.dbg.assign(metadata i32 %add1, metadata !32, metadata !DIExpression(), metadata !31, metadata ptr %p, metadata !DIExpression()), !dbg !16
-;; %add1 is not salvaged as it requires two values and DIArgList is
-;; not (yet) supported for dbg.assigns.
-; CHECK-NEXT: call void @llvm.dbg.assign(metadata i32 poison,{{.+}}, metadata !DIExpression(),{{.+}}, metadata ptr %p, metadata !DIExpression())
+;; %add1 is salvaged using a variadic expression.
+; CHECK-NEXT: call void @llvm.dbg.assign(metadata !DIArgList(i32 %x, i32 %y), metadata ![[#]], metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), metadata ![[#]], metadata ptr %p, metadata !DIExpression())
 
   %arrayidx0 = getelementptr inbounds i32, ptr %p, i32 0
   call void @llvm.dbg.assign(metadata i32 %x, metadata !14, metadata !DIExpression(), metadata !17, metadata ptr %arrayidx0, metadata !DIExpression()), !dbg !16


        


More information about the llvm-commits mailing list