aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/IntrinsicInst.cpp
diff options
context:
space:
mode:
authorOCHyams <orlando.hyams@sony.com>2022-11-23 13:32:53 +0000
committerOCHyams <orlando.hyams@sony.com>2022-11-23 13:56:34 +0000
commit7707d4913b6adf9d411ff5ab5fa449dff2dd76b0 (patch)
tree6dab78f004f2382cf5cd5fa3ae12197648e3d456 /llvm/lib/IR/IntrinsicInst.cpp
parentcb0d2887ab8f54f8dea72149904468f61cfc0d5b (diff)
downloadllvm-7707d4913b6adf9d411ff5ab5fa449dff2dd76b0.zip
llvm-7707d4913b6adf9d411ff5ab5fa449dff2dd76b0.tar.gz
llvm-7707d4913b6adf9d411ff5ab5fa449dff2dd76b0.tar.bz2
[Assignment Tracking] Fix DbgVariableIntrinsic::replaceVariableLocationOp
Fix replaceVariableLocationOp unconditionally replacing the first operand of a dbg.assign. Reviewed By: jryans Differential Revision: https://reviews.llvm.org/D138561
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r--llvm/lib/IR/IntrinsicInst.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index b6537b2..f91b148 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -130,6 +130,11 @@ void DbgVariableIntrinsic::replaceVariableLocationOp(Value *OldValue,
assert((OldIt != Locations.end() || DbgAssignAddrReplaced) &&
"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(