Issue 139219
Summary [DebugInfo][CodeGenPrepare] Debug value loss caused by deleting the and instruction
Labels llvm:codegen, debuginfo
Assignees
Reporter Apochens
    CodeGenPrepare pass deletes the `and` instruction without salvaging the debug value: https://godbolt.org/z/3d5f7v3oG

https://github.com/llvm/llvm-project/blob/fa2a6d68c6f35e478af3425760ae39e866049eee/llvm/lib/CodeGen/CodeGenPrepare.cpp#L2274

IR before CodeGenPrepare:
```llvm
entry:
  %and = and i32 %a, 4, !dbg !13
 #dbg_value(i32 %and, !9, !DIExpression(), !13)
  br i1 %c, label %bb0, label %bb2, !dbg !14
```

IR after CodeGenPrepare:

```llvm
  entry:
 #dbg_value(i32 poison, !9, !DIExpression(), !11)
    br i1 %c, label %bb0, label %bb2, !dbg !12
```

I'd like to give a PR to fix it.

cc @OCHyams, could you please give me an example of how regression tests check the debug info in CodeGen? (I'm not very familiar with CodeGen...)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to