[llvm] [HWASAN] Update dbg.assign intrinsics in HWAsan pass (PR #79864)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 13:58:19 PST 2024


================
@@ -110,6 +110,24 @@ Instruction *getUntagLocationIfFunctionExit(Instruction &Inst) {
 }
 
 void StackInfoBuilder::visit(Instruction &Inst) {
+  // Visit non-intrinsic debug-info records attached to Inst.
+  for (auto &DPV : Inst.getDbgValueRange()) {
+    auto AddIfInteresting = [&](Value *V) {
+      if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) {
+        if (!isInterestingAlloca(*AI))
+          return;
+        AllocaInfo &AInfo = Info.AllocasToInstrument[AI];
+        auto &DPVVec = AInfo.DbgVariableRecords;
+        if (DPVVec.empty() || DPVVec.back() != &DPV)
+          DPVVec.push_back(&DPV);
+      }
+    };
+    for (Value *V : DPV.location_ops())
----------------
fmayer wrote:

optional nit: for_each

https://github.com/llvm/llvm-project/pull/79864


More information about the llvm-commits mailing list