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

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 01:52:57 PDT 2024


================
@@ -580,6 +580,10 @@ rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI,
       if (DbgItem->isAddressOfVariable()) {
         ConvertDebugDeclareToDebugValue(DbgItem, Info.OnlyStore, DIB);
         DbgItem->eraseFromParent();
+      } else if (DbgItem->isValueOfVariable() &&
+                 DbgItem->getExpression()->startsWithDeref()) {
+        InsertDebugValueAtStoreLoc(DbgItem, Info.OnlyStore, DIB);
----------------
SLTozer wrote:

But we're changing the debug value to point from the alloca to the value stored in the alloca right? In the same way that we replace a `dbg.declare` of the alloca with a `dbg.value` of the stored value, we should be replacing a `dbg.value` that derefs the alloca with a `dbg.value` of the stored value, without the deref.

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


More information about the llvm-commits mailing list