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

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 03:32:52 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:

Doesn't this take the expression of the existing DbgItem, i.e. it will still have the deref even after mem2reg?

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


More information about the llvm-commits mailing list