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

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 10:36:10 PDT 2024


================
@@ -5045,10 +5045,20 @@ static void insertNewDbgInst(DIBuilder &DIB, DbgVariableRecord *Orig,
                                                    BeforeInst->getIterator());
     return;
   }
+
+  if (Orig->isDbgValue()) {
+    DbgVariableRecord *DVR = DbgVariableRecord::createDbgVariableRecord(
+        NewAddr, Orig->getVariable(), NewFragmentExpr, Orig->getDebugLoc());
+    BeforeInst->getParent()->insertDbgRecordBefore(DVR,
+                                                   BeforeInst->getIterator());
----------------
rastogishubham wrote:

Sorry about that, it is resolved now, there is one issue however, @SLTozer mentioned that the check for the DW_OP_deref should be in the caller for this function, but this function has 2 overloads, i.e. 3 variations total. The functions can take a `DbgVariableRecord`, `DbgAssignIntrinsic`, or a `DbgDeclareInst`. We only care about the `DbgVariableRecord` case, but the caller doesn't distinguish between them because it is a lambda function that can take any of the three options as an input. So I had to handle the dropping of the debug info in the function itself rather than it's caller

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


More information about the llvm-commits mailing list