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

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 13:52:09 PDT 2024


================
@@ -129,9 +129,8 @@ define void @test3(ptr %x) {
 ; CHECK-DEBUGLOC-LABEL: @test3(
 ; CHECK-DEBUGLOC-NEXT:  entry:
 ; CHECK-DEBUGLOC-NEXT:    [[A_SROA_0:%.*]] = alloca [22 x i8], align 8, !dbg [[DBG47:![0-9]+]]
-; CHECK-DEBUGLOC-NEXT:      #dbg_value(ptr undef, [[META44:![0-9]+]], !DIExpression(), [[DBG47]])
+; CHECK-DEBUGLOC-NEXT:      #dbg_value(ptr [[A_SROA_0]], [[META44:![0-9]+]], !DIExpression(), [[DBG47]])
 ; CHECK-DEBUGLOC-NEXT:    [[B_SROA_0:%.*]] = alloca [18 x i8], align 2, !dbg [[DBG48:![0-9]+]]
-; CHECK-DEBUGLOC-NEXT:      #dbg_value(ptr undef, [[META45:![0-9]+]], !DIExpression(), [[DBG48]])
----------------
rastogishubham wrote:

Hi @SLTozer , if you look at the function:
`SROA::deleteDeadInstructions`
I added the code:

```
for (DbgVariableRecord *OldDII : findDVRValues(AI))
        OldDII->eraseFromParent();
```

This will erase the `#dbg_value(ptr %b, [[META45:![0-9]+]], !DIExpression(), [[DBG48]])` instead of changing it to a `#dbg_value(ptr undef, [[META45:![0-9]+]], !DIExpression(), [[DBG48]])`

Should we just undef these instead?

I hope that answers your question. 

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


More information about the llvm-commits mailing list