[PATCH] D145915: [Assignment Tracking] Allow salvaging with variadic expressions [4/x]
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 02:43:17 PDT 2023
Orlando created this revision.
Orlando added reviewers: StephenTozer, jmorse, scott.linder, jryans.
Orlando added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Allow the value-component of a dbg.assign to be salvaged using a variadic DIExpression
https://reviews.llvm.org/D145915
Files:
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
Index: llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
===================================================================
--- llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
+++ llvm/test/DebugInfo/Generic/assignment-tracking/salvage-value.ll
@@ -14,9 +14,8 @@
%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
Index: llvm/lib/Transforms/Utils/Local.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Local.cpp
+++ llvm/lib/Transforms/Utils/Local.cpp
@@ -1913,17 +1913,14 @@
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');
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145915.504565.patch
Type: text/x-patch
Size: 2618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230313/c5f45c63/attachment.bin>
More information about the llvm-commits
mailing list