diff options
author | Stephen Tozer <Stephen.Tozer@Sony.com> | 2021-03-11 15:01:37 +0000 |
---|---|---|
committer | Stephen Tozer <Stephen.Tozer@Sony.com> | 2021-04-12 16:57:29 +0100 |
commit | f2e4f3eff3c9135d92840016f8ed4540cdd1313b (patch) | |
tree | 0a88adc25889b35c9e3b7e9c890a0cd479521d09 /llvm/lib/IR/IntrinsicInst.cpp | |
parent | 8508b1c133f6dea558fd62f73cf333bdec809026 (diff) | |
download | llvm-f2e4f3eff3c9135d92840016f8ed4540cdd1313b.zip llvm-f2e4f3eff3c9135d92840016f8ed4540cdd1313b.tar.gz llvm-f2e4f3eff3c9135d92840016f8ed4540cdd1313b.tar.bz2 |
Reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands"
The causes of the previous build errors have been fixed in revisions
aa3e78a59fdf3b211be72f1b3221af831665e67d, and
140757bfaaa00110a92d2247a910c847e6e3bcc8
This reverts commit f40976bd01032f4905dde361e709166704581077.
Diffstat (limited to 'llvm/lib/IR/IntrinsicInst.cpp')
-rw-r--r-- | llvm/lib/IR/IntrinsicInst.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp index 14b8732..80198d4 100644 --- a/llvm/lib/IR/IntrinsicInst.cpp +++ b/llvm/lib/IR/IntrinsicInst.cpp @@ -118,6 +118,23 @@ void DbgVariableIntrinsic::replaceVariableLocationOp(unsigned OpIdx, 0, MetadataAsValue::get(getContext(), DIArgList::get(getContext(), MDs))); } +void DbgVariableIntrinsic::addVariableLocationOps(ArrayRef<Value *> NewValues, + DIExpression *NewExpr) { + assert(NewExpr->hasAllLocationOps(getNumVariableLocationOps() + + NewValues.size()) && + "NewExpr for debug variable intrinsic does not reference every " + "location operand."); + assert(!is_contained(NewValues, nullptr) && "New values must be non-null"); + setArgOperand(2, MetadataAsValue::get(getContext(), NewExpr)); + SmallVector<ValueAsMetadata *, 4> MDs; + for (auto *VMD : location_ops()) + MDs.push_back(getAsMetadata(VMD)); + for (auto *VMD : NewValues) + MDs.push_back(getAsMetadata(VMD)); + setArgOperand( + 0, MetadataAsValue::get(getContext(), DIArgList::get(getContext(), MDs))); +} + Optional<uint64_t> DbgVariableIntrinsic::getFragmentSizeInBits() const { if (auto Fragment = getExpression()->getFragmentInfo()) return Fragment->SizeInBits; |