[llvm] [DebugInfo][RemoveDIs] Support DPValues in HWAsan (PR #78731)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 15:17:20 PST 2024
================
@@ -1425,17 +1425,24 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
return User != AILong && User != AICast && !isLifetimeIntrinsic(User);
});
- for (auto *DDI : Info.DbgVariableIntrinsics) {
+ // Helper utility for adding DW_OP_LLVM_tag_offset to debug-info records,
+ // abstracted over whether they're intrinsic-stored or DPValue stored.
+ auto AnnotateDbgRecord = [&](auto *DPtr) {
// Prepend "tag_offset, N" to the dwarf expression.
// Tag offset logically applies to the alloca pointer, and it makes sense
// to put it at the beginning of the expression.
SmallVector<uint64_t, 8> NewOps = {dwarf::DW_OP_LLVM_tag_offset,
retagMask(N)};
- for (size_t LocNo = 0; LocNo < DDI->getNumVariableLocationOps(); ++LocNo)
- if (DDI->getVariableLocationOp(LocNo) == AI)
- DDI->setExpression(DIExpression::appendOpsToArg(DDI->getExpression(),
- NewOps, LocNo));
- }
+ for (size_t LocNo = 0; LocNo < DPtr->getNumVariableLocationOps(); ++LocNo)
+ if (DPtr->getVariableLocationOp(LocNo) == AI)
+ DPtr->setExpression(DIExpression::appendOpsToArg(DPtr->getExpression(),
+ NewOps, LocNo));
+ };
+
+ for (auto *DDI : Info.DbgVariableIntrinsics)
----------------
fmayer wrote:
optional nit:
```
llvm::for_each(Info.DbgVariableIntrinsics, AnnotateDbgRecord);
llvm::for_each(Info.DbgVariableIntrinsics, DbgVariableRecords);
```
https://github.com/llvm/llvm-project/pull/78731
More information about the llvm-commits
mailing list