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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 08:51:49 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());
----------------
adrian-prantl wrote:

Thanks, that addresses one half of my concern. But, shouldn't we still verify that the dbg.value describes the value inside the alloca? If a dbg.value doesn't have a deref, it describes the *address* of the allcoa, and I don't think this is something we can handle here.

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


More information about the llvm-commits mailing list