[PATCH] D147922: [Assignment Tracking] Fix replaceVariableLocationOp for dbg.assign with DIArgList
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 09:20:38 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc95b322b738b: [Assignment Tracking] Fix replaceVariableLocationOp for dbg.assign with… (authored by Orlando).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147922/new/
https://reviews.llvm.org/D147922
Files:
llvm/lib/IR/IntrinsicInst.cpp
llvm/unittests/IR/DebugInfoTest.cpp
Index: llvm/unittests/IR/DebugInfoTest.cpp
===================================================================
--- llvm/unittests/IR/DebugInfoTest.cpp
+++ llvm/unittests/IR/DebugInfoTest.cpp
@@ -370,6 +370,12 @@
// Replace both.
TEST_REPLACE(/*Old*/ P2, /*New*/ P1, /*Value*/ P1, /*Address*/ P1);
+ // Replace address only, value uses a DIArgList.
+ // Value = {DIArgList(V1)}, Addr = P1.
+ DAI->setRawLocation(DIArgList::get(C, ValueAsMetadata::get(V1)));
+ DAI->setExpression(DIExpression::get(
+ C, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_stack_value}));
+ TEST_REPLACE(/*Old*/ P1, /*New*/ P2, /*Value*/ V1, /*Address*/ P2);
#undef TEST_REPLACE
}
Index: llvm/lib/IR/IntrinsicInst.cpp
===================================================================
--- llvm/lib/IR/IntrinsicInst.cpp
+++ llvm/lib/IR/IntrinsicInst.cpp
@@ -135,14 +135,14 @@
assert(NewValue && "Values must be non-null");
auto Locations = location_ops();
auto OldIt = find(Locations, OldValue);
- assert((OldIt != Locations.end() || DbgAssignAddrReplaced) &&
- "OldValue must be a current location");
+ if (OldIt == Locations.end()) {
+ assert(DbgAssignAddrReplaced &&
+ "OldValue must be dbg.assign addr if unused in DIArgList");
+ return;
+ }
+
+ assert(OldIt != Locations.end() && "OldValue must be a current location");
if (!hasArgList()) {
- // Additional check necessary to avoid unconditionally replacing this
- // operand when a dbg.assign address is replaced (DbgAssignAddrReplaced is
- // true).
- if (OldValue != getVariableLocationOp(0))
- return;
Value *NewOperand = isa<MetadataAsValue>(NewValue)
? NewValue
: MetadataAsValue::get(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147922.512490.patch
Type: text/x-patch
Size: 1758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230411/d672949b/attachment.bin>
More information about the llvm-commits
mailing list