[llvm] Handle #dbg_values in SROA. (PR #94070)

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 12:41:05 PDT 2024


================
@@ -5000,10 +5000,25 @@ static void insertNewDbgInst(DIBuilder &DIB, DbgVariableRecord *Orig,
                                                    BeforeInst->getIterator());
     return;
   }
+
+  if (Orig->isDbgValue()) {
+    // Drop debug information if the expression doesn't start with a
+    // DW_OP_deref. This is because without a DW_OP_deref, the #dbg_value
+    // describers the address of alloca rather than the value inside the alloca.
+    if (!NewFragmentExpr->startsWithDeref())
+      return;
----------------
rastogishubham wrote:

I think what you say makes sense, I have updated the patch to reflect that

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


More information about the llvm-commits mailing list