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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 09:18:43 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:

I was expecting some code checking for a DW_OP_deref and removing the DW_OP_deref here. Why is this not needed? Is it because we currently (incorrectly) implicitly treat dbg.value(alloca) as having an implicit op_deref?

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


More information about the llvm-commits mailing list